Add functions to check if an error is a given pgconn error#28
Add functions to check if an error is a given pgconn error#28ajruckman wants to merge 1 commit intojackc:masterfrom
Conversation
|
I have two concerns with this. Types errors, whether directly exposed as public types or through It only makes sense to expose error type information if it can be meaningfully acted upon by the caller. Rather than exposing all error types, every exposure needs to be justified by something the caller would do differently. For example, the only time the proposed Secondly, even if we decide to expose some additional type information I don't think that So what we need to know to go forward is what decision does the calling code want to make and then what is the smallest interface in |
|
I agree that the My problem may be better solved with new method like I could create a function |
|
This is much better. I think we are getting really close to an ideal solution. But I have two more small points to bring up. First, in general it is safe to consider any failure from But assuming this is something that could or should be used on an error returned from any function then I'd like to consider other names.
I would propose |
I have a need to check whether an error is a
pgconn.writeErrororpgconn.connLockErrorfor a project, but these errors are not exported.