2
0

Use github.com/pkg/errors

This commit is contained in:
Jack Christensen
2017-06-04 21:30:03 -05:00
parent 3ea41e6972
commit 8f4178b3d3
86 changed files with 639 additions and 597 deletions
+4 -3
View File
@@ -68,12 +68,13 @@ import (
"database/sql"
"database/sql/driver"
"encoding/binary"
"errors"
"fmt"
"io"
"strings"
"sync"
"github.com/pkg/errors"
"github.com/jackc/pgx"
"github.com/jackc/pgx/pgtype"
)
@@ -260,7 +261,7 @@ func (c *Conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, e
case sql.LevelSerializable:
pgxOpts.IsoLevel = pgx.Serializable
default:
return nil, fmt.Errorf("unsupported isolation: %v", opts.Isolation)
return nil, errors.Errorf("unsupported isolation: %v", opts.Isolation)
}
if opts.ReadOnly {
@@ -546,7 +547,7 @@ func ReleaseConn(db *sql.DB, conn *pgx.Conn) error {
driver.fakeTxMutex.Unlock()
} else {
driver.fakeTxMutex.Unlock()
return fmt.Errorf("can't release conn that is not acquired")
return errors.Errorf("can't release conn that is not acquired")
}
return tx.Rollback()