sql

All things SQL and JDBC...
afhammad 2020-11-12T11:41:11.317200Z

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)

seancorfield 2020-11-12T15:44:22.318500Z

I don't know of any libraries to handle that, so I assume folks use custom try/`catch` logic.

dpsutton 2020-11-12T15:47:16.319500Z

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

lukasz 2020-11-12T15:47:35.319700Z

same

lukasz 2020-11-12T15:48:52.320100Z

I have this ugly macro https://gist.github.com/lukaszkorecki/9568a224b9e14d7259bc5032ae30ffa1 - it's not great, but works for the most part

afhammad 2020-11-12T18:38:59.321400Z

Yeh i’ve gone with status code and string parsing for now, was hoping it was a solved problem though