I've run into a number of times where I encounter a *pq.Error and realize I need some special handling for it. But I need to know the Postgres error code so I can check to make sure I'm handling the right error.
Currently, I have to look at the error string, try to figure out what error code it is (having neither the error code nor the condition name listed here), then add the needed special handling for the specific error code.
It would be really nice if the error string ((*pq.Error).Error()) just included the error code to ease special handling needed for that error.
I've run into a number of times where I encounter a
*pq.Error
and realize I need some special handling for it. But I need to know the Postgres error code so I can check to make sure I'm handling the right error.Currently, I have to look at the error string, try to figure out what error code it is (having neither the error code nor the condition name listed here), then add the needed special handling for the specific error code.
It would be really nice if the error string (
(*pq.Error).Error()
) just included the error code to ease special handling needed for that error.