-
Notifications
You must be signed in to change notification settings - Fork 352
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 correct error from Rows::next #302
Conversation
Same with prepare. What was the the motivation for #296? Is there a particular example that led to it? |
@haaawk The motivation was to fix the failing tests in http://github.com/prisma/prisma-engines when compiling with libSQL instead of SQLite+rusqlite, and make the errors work similar to rusqlite. We match on extended result codes and parse the error messages, so not exposing that information would be a problem and will break our error handling. It will also make the error messages quite cryptic for libSQL users in general. As for extended codes, it's possible to use https://www.sqlite.org/c3ref/extended_result_codes.html once after connecting to get them directly in the result code, but as for the error messages, I'm afraid there's no other way to get them except how it was done in #296.
To illustrate the difference using a random test from our codebase:
As for why it's possible for the errors to get mixed up in the Go tests, is there any chance they are running concurrently without synchronization? The Rust API contract for For what it's worth, SQLite documentation suggests wrapping the operation that may error and reading the error itself with |
Looking at the code though, I'm not sure if concurrency is the problem here, and the expected error message doesn't look right to me:
The error code and description mismatch here, |
I can clearly see how extended error messages are better. The question is why are they returning a wrong description. The failing test has absolutely nothing to do with |
We should try the mutex thing and see if it helps |
Signed-off-by: Piotr Jastrzebski <[email protected]>
03114c5
to
c16b216
Compare
Revert the change introduced by 77c8b71. It caused a wrong error being returned.
For example
column index out of range
was returned whendatabase is locked
was expected.