-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Return Result
s from DB executor functions
#109
Return Result
s from DB executor functions
#109
Conversation
* Previously, the code for `Executor::fetch_all` and similar functions used `.unwrap()` internally and panicked if any error happened during the call. This could result in schema detection causing panics in cases of things like spurious network issues, connection pool exhaustion, and other transitory issues with the DB. * Migrate all of the executor functions to return `Result<T, sqlx::Error>` to bubble up errors * Update all schema detection functions to bubble up errors as well and migrate code to handle addition of `Result` return types * Note that this is a breaking change to the crate's public API surface. Callers will need to be updated to handle the fact that schema detection returns `Result`s now. * Fixes SeaQL#106
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Ameobea, thanks for the contribution!! Nice update to the API!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool. Thank you
🎉 Released In 0.12.0 🎉Thank you everyone for the contribution! |
Previously, the code for
Executor::fetch_all
and similar functions used.unwrap()
internally and panicked if any error happened during the call. This could result in schema detection causing panics in cases of things like spurious network issues, connection pool exhaustion, and other transitory issues with the DB.PR Info
Fixes #106
Breaking Changes
This introduces a breaking change to the crate's public API surface. Callers will need to be updated to handle the fact that schema detection returns
Result
s now.This is definitely unavoidable, but updating shouldn't be too difficult. Callers can just
.unwrap()
to retain the existing behavior of panicking in the case of any DB or connection error.Changes
Result<T, sqlx::Error>
to bubble up errorsResult
return types