jackc/pgx

Clarify ErrIsClosed return type in docs

redbaron opened this issue · 1 comments

Docs are a bit unclear how ErrTxClosed is returned from Rollback.

Tx interface docs uses wording errors.Is(ErrTxClosed) which implies it can be wrapped into another Error value. At the same time Tx from pgxpool explicitly says that returned error is ErrTxClosed exactly, implying it is not wrapped.

It is important distinction, because Go Error handling guidelines make a point that if error is known to be unwrapped (like io.EOF they talk about) then direct comparison should be used not errors.Is.

The error is not wrapped at the moment, but they documentation says to use errors.Is to allow for wrapping in the future.

I've updated the docs for pgxpool.