diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-03-26 23:28:29 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-03-26 23:28:29 +0200 |
| commit | 24b7455f76ff222b07a1277adda131802d401d22 (patch) | |
| tree | f256dd9912909e031355a0c1ebd13997a95a281d | |
| parent | 2d2919fda954812d695ff375fa4491029a8154bc (diff) | |
| download | bridge-24b7455f76ff222b07a1277adda131802d401d22.tar.gz bridge-24b7455f76ff222b07a1277adda131802d401d22.zip | |
use pg-native serialization error detection
| -rw-r--r-- | api.js | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -121,7 +121,9 @@ async function db_serialized(con, query, data) { await con.query("ROLLBACK"); // serialization error - expected, else rethrow console.error(err); - if (err.code != "40001") throw err; + if (err.sqlState != "40001") throw err; + // important! with pg, it is err.code, + // with pg-native, it is err.sqlState } /* transaction end */ } while (!commit_success); |
