Skip to content

Best practices for error handling #63

Answered by groue
ChristophKaser asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @ChristophKaser,

Thanks for migrating to 0.10.0, where apps can detect if an error happens. I'm not sure there is a good answer about handling them yet, because:

Am I wrong in thinking that errors in a GRDBQuery should not normally occur unless I made a mistake when writing the query? Should I handle errors more gracefully than calling fatalError?

Since we're dealing with read-only queries, errors should generally be a programmer error (an invalid query that requires code to be changed), or an I/O error. I/O can always fail, unfortunately. I/O error can happen on locked device in the background, due to data protection, for example.

I personally never had to deal with such errors, …

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@ChristophKaser
Comment options

@groue
Comment options

groue Feb 4, 2025
Maintainer

@ChristophKaser
Comment options

@ChristophKaser
Comment options

@groue
Comment options

groue Feb 4, 2025
Maintainer

Answer selected by ChristophKaser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants