Hi, what's the recommended approach to translating Postgres constraint errors into user friendly error messages? (currently using next.jdbc and Hugsql if that helps)
I don't know of any libraries to handle that, so I assume folks use custom try
/`catch` logic.
at my previous job we had some regexes to pull apart the returned error strings from pg and turn it into a data structure. lots of matching on error types, error string, spec errors, etc
same
I have this ugly macro https://gist.github.com/lukaszkorecki/9568a224b9e14d7259bc5032ae30ffa1 - it's not great, but works for the most part
Yeh i’ve gone with status code and string parsing for now, was hoping it was a solved problem though