<div dir="ltr">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'.<div><br></div><div>-aslak-</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 30, 2016 at 10:50 AM, Thomas Mäder <span dir="ltr"><<a href="mailto:tmader@redhat.com" target="_blank">tmader@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi folks,<br>
<br>
Looking for the general opinion here:<br>
<br>
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.<br>
<br>
Do you think it would be generally a good idea to do this in our db access code?<br>
<br>
/Thomas<br>
<br>
______________________________<wbr>_________________<br>
almighty-public mailing list<br>
<a href="mailto:almighty-public@redhat.com" target="_blank">almighty-public@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/almighty-public" rel="noreferrer" target="_blank">https://www.redhat.com/mailman<wbr>/listinfo/almighty-public</a><br>
</blockquote></div><br></div>