in reply to Mapping database errors to user errors

Your best bet is to rely on SQLSTATE (aka $h->state()). Alas,

You may be able to find SQLSTATE mappings for most dbms's, which you could then stick into a DBMS, along w/ their associated error code(s). And JOIN away...but be sure to use OUTER JOINs, cuz theres going to be a lot of NULLs in there.

I've been looking for a similar solution (but only for SQLSTATE <=> specific error codes), and its proven quite a task. I had hoped Google would surface enough pieces of the solution that I could pop into a dbms and boil down, but thus far I've had limited success.

  • Comment on Re: Mapping database errors to user errors