2
0

PG error type is *pgconn.PgError

This commit is contained in:
Jack Christensen
2018-12-31 17:46:56 -06:00
parent 103ab963eb
commit 378ccb8945
14 changed files with 40 additions and 34 deletions
+2 -2
View File
@@ -142,7 +142,7 @@ func TestTxCommitSerializationFailure(t *testing.T) {
}
err = tx2.Commit()
if pgErr, ok := err.(pgx.PgError); !ok || pgErr.Code != "40001" {
if pgErr, ok := err.(*pgconn.PgError); !ok || pgErr.Code != "40001" {
t.Fatalf("Expected serialization error 40001, got %#v", err)
}
}
@@ -228,7 +228,7 @@ func TestBeginExReadOnly(t *testing.T) {
defer tx.Rollback()
_, err = conn.Exec("create table foo(id serial primary key)")
if pgErr, ok := err.(pgx.PgError); !ok || pgErr.Code != "25006" {
if pgErr, ok := err.(*pgconn.PgError); !ok || pgErr.Code != "25006" {
t.Errorf("Expected error SQLSTATE 25006, but got %#v", err)
}
}