Skip to content

Request for comments: Unify exception throwing #182

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

Closed
vaind opened this issue Jan 29, 2021 · 1 comment · Fixed by #223
Closed

Request for comments: Unify exception throwing #182

vaind opened this issue Jan 29, 2021 · 1 comment · Fixed by #223
Labels
enhancement New feature or request question How to do something/general question
Milestone

Comments

@vaind
Copy link
Contributor

vaind commented Jan 29, 2021

We're currently throwing ObjectBoxException as well as Exception.

  • Either get rid of the former or use it in all places?
  • Or actually use more specific classes, depending on what kind of exception it is? Like ArgumentError, StateError and reserve the generic Exception for cases when we can't do any better?
  • What's the best practice?
@vaind vaind added enhancement New feature or request question How to do something/general question labels Jan 29, 2021
@greenrobot
Copy link
Member

I think it would make sense to ...

  • use general ArgumentError and the likes where they fit
  • use DbException when something goes wrong with the db (after checking it's not e.g. a argument error internally).
  • I cannot think of cases where a plain Exception would make sense; would have to be reviewed on an individual basis.

@vaind vaind added this to the 1.0 milestone Mar 11, 2021
@vaind vaind mentioned this issue Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question How to do something/general question
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants