You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think current error message lacks some important information.
For example, when I try to insert a record and operation violates some constraint, then error message (PgError.Message) does not contain info about which record caused the error. It only says than constraint violation occured.
Could you please add Detail filed to (pe *PgError) Error() method?
I know that I can cast err to pgconn.PgError, but I think it would be more conveniently to see error details by default.
The text was updated successfully, but these errors were encountered:
That would be convenient in many cases. But I'm concerned about how long the error message could be. DETAIL sometimes echos back the entire failing row. This could make the error message hundreds of characters long. I don't think there is an actual hard rule about how long a Go error string should be, but it seems idiomatic to be pretty short. There's also the matter of how to format it. psql splits that type of error onto multiple lines. e.g.
Maybe you should return say first 100 bytes of Detail message?
I got your point but in my experience error messages themselves are pretty useless: something like SQL ERROR 23305. So choose yourself but I think some additional info required.
I think current error message lacks some important information.
For example, when I try to insert a record and operation violates some constraint, then error message (PgError.Message) does not contain info about which record caused the error. It only says than constraint violation occured.
Could you please add
Detail
filed to(pe *PgError) Error()
method?I know that I can cast err to pgconn.PgError, but I think it would be more conveniently to see error details by default.
The text was updated successfully, but these errors were encountered: