From 24b7455f76ff222b07a1277adda131802d401d22 Mon Sep 17 00:00:00 2001 From: schneefux Date: Sun, 26 Mar 2017 23:28:29 +0200 Subject: use pg-native serialization error detection --- api.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'api.js') diff --git a/api.js b/api.js index 6f795dc..6a2ec01 100644 --- a/api.js +++ b/api.js @@ -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); -- cgit v1.3.1