Repository navigation
Postgresql exceptions #353
Description
Activity
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.
- added a commit that references this issue
on Jan 16, 2015 So, I've took a stab at this, let me know what you think.
Thanks!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.
Will take care of this tomorrowThanks! :)
- added a commit that references this issue
on May 28, 2015
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
failwhich then gets turned into a UserError/IOError by with.Would there be any way to
bracketaninsertjust onSqlError, or do I have to bracket into the far more generalIOError?Thanks