-
Notifications
You must be signed in to change notification settings - Fork 292
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
Postgresql exceptions #353
Comments
I'm not able to work on the codebase right now (getting ready to travel), but this seems like a reasonable request. If someone sends a PR, I'll be happy to merge. Otherwise, I probably won't be able to get to this for another week or two. |
So, I've took a stab at this, let me know what you think. |
This looks good to me, sorry for the delayed review. Unless someone has an objection, I'd merge this in. |
Thanks! |
Would this by any chance expose the underlying Postgres error code or whatever it is translated to by the library being used to execute the query? e.g. PostgreSQL.Simple exposes a type for constraint violation errors. It's useful to pattern-match against for insertions and updates, when you want to perform the operation first, and handle the exception, as opposed to the less reliable check & insert approach. |
That's precisely my use case, and why I submitted this patch ;) |
+1 |
@snoyberg do you know what the status of this issue is? |
IIRC, I'm waiting for @jcristovao to send a PR with his change. Though if people are more eager to see this go out the door, anyone else could theoretically take @jcristovao's commit and send it as a PR him/herself. |
Ok, I forgot I did not actually submited this as a PR, my bad. |
Thanks! :) |
Addresses Postgresql exceptions #353
Hello,
Perhaps I'm missing something obvious, but I somewhat was expecting
withStmt'
to return a SqlError, not a user error:I guess this as to do with using
fail
which then gets turned into a UserError/IOError by with.Would there be any way to
bracket
aninsert
just onSqlError
, or do I have to bracket into the far more generalIOError
?Thanks
The text was updated successfully, but these errors were encountered: