Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Code health] Revisit use of Exceptions and Nullable Types #2216

Open
scolsen opened this issue Feb 2, 2024 · 1 comment · May be fixed by #2218
Open

[Code health] Revisit use of Exceptions and Nullable Types #2216

scolsen opened this issue Feb 2, 2024 · 1 comment · May be fixed by #2218
Labels
type: code health Improvements to readability or robustness of codebase
Milestone

Comments

@scolsen
Copy link
Contributor

scolsen commented Feb 2, 2024

There are a few places in the code base where we currently throw exceptions that we might be able to convert to nullable return values or Kotlin's Result type instead, for example, in the SubmissionConverter.

We should do a pass to see if there are any cases in which we're overusing exceptions, or not using exceptions for cases that really are exceptional.

See #2214 (comment) for additional context.

@scolsen scolsen added the type: code health Improvements to readability or robustness of codebase label Feb 2, 2024
scolsen added a commit to scolsen/ground-android that referenced this issue Feb 2, 2024
Return null when attempting to retrieve unknown tasks from a Job (instead of throwing an exception). Updates callers accordingly.

Fixes google#2216
@scolsen scolsen linked a pull request Feb 2, 2024 that will close this issue
@gino-m
Copy link
Collaborator

gino-m commented Feb 16, 2024

Once case where this might be used is in converter logic; converters could return Result rather than an exception so that there are compile-checks to ensure coroutines and Flows handle them correctly. See also google/ground-platform#931.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: code health Improvements to readability or robustness of codebase
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants