Skip to content

Provide helpful error messages #13

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
greenrobot opened this issue Sep 4, 2019 · 3 comments
Closed

Provide helpful error messages #13

greenrobot opened this issue Sep 4, 2019 · 3 comments
Labels
help wanted Looking for contributors (ideas, comments, code, etc)
Milestone

Comments

@greenrobot
Copy link
Member

If I'm not wrong, the check(cond) does not result in helpful messages.

To be more friendly to users, we should tell a) what's wrong and b) how to fix it.

@greenrobot greenrobot added the help wanted Looking for contributors (ideas, comments, code, etc) label Sep 4, 2019
@greenrobot greenrobot added this to the 0.2 milestone Sep 4, 2019
@Offtree
Copy link

Offtree commented Sep 4, 2019

Might want to consider using the dart lang assert instead of the home brewed check function assuming you'd only want to run these assertions in development mode.

@greenrobot
Copy link
Member Author

@Offtree Thanks, we'll have to decide on a case by case basis what is more suitable.

And, I just realized that have to clarify the issue and propose:

  • checkObxPtr in addition to checkObx; throwing when a pointer from objectbox is invalid (NULL in C)
  • check on anything model related (aka defined by user) should tell a) what's wrong and b) how to fix it; e.g. check(_idPropIdx != -1)
  • use assert for "paranoia" mode in debug mode to have additional check on internals

Not sure if the pure check is still needed after that.

@nalenz-objectbox
Copy link
Contributor

check has now been fully removed and checkObxPtr was added, which also reports a message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Looking for contributors (ideas, comments, code, etc)
Projects
None yet
Development

No branches or pull requests

3 participants