[almighty] Analyzing Postgres Errors

Aslak Knutsen aslak at redhat.com
Wed Nov 30 10:31:30 UTC 2016


Yeah, make a single Function that can be called that does the cast down /
conversion to some 'normal' error and use that 'all over the place'.

-aslak-

On Wed, Nov 30, 2016 at 10:50 AM, Thomas Mäder <tmader at redhat.com> wrote:

> Hi folks,
>
> Looking for the general opinion here:
>
> As I was writing some gorm db code, I noticed that we could profit from
> analyzing the error returned by db calls. In this particular case, postgres
> returns "unique_violation" when trying to create a second project with the
> same name. In consequence, I could return "BadParameter" instead of just
> "internal error". Unfortunately, these structured errors are entirely
> specific to postgres. We'd have to cast down to a postgres error struct to
> get the info.
>
> Do you think it would be generally a good idea to do this in our db access
> code?
>
> /Thomas
>
> _______________________________________________
> almighty-public mailing list
> almighty-public at redhat.com
> https://www.redhat.com/mailman/listinfo/almighty-public
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/almighty-public/attachments/20161130/c172e006/attachment.htm>


More information about the almighty-public mailing list