postgres: improve readability of error check
This commit is contained in:
parent
9b9013a560
commit
aa068b667a
@ -71,7 +71,7 @@ var (
|
|||||||
|
|
||||||
err = tx.Commit()
|
err = tx.Commit()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if pqErr, ok := err.(*pq.Error); ok && pqErr.Code == "40001" {
|
if pqErr, ok := err.(*pq.Error); ok && pqErr.Code.Name() == "serialization_failure" {
|
||||||
// serialization error; retry
|
// serialization error; retry
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user