summaryrefslogtreecommitdiff
path: root/api.js
diff options
context:
space:
mode:
Diffstat (limited to 'api.js')
-rw-r--r--api.js4
1 files changed, 3 insertions, 1 deletions
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);