From b8d696eaed3510666014d57e114556ea7ef8ab42 Mon Sep 17 00:00:00 2001 From: Vainsocial root Date: Sun, 12 Mar 2017 14:50:11 +0000 Subject: catch and fail on SQL error --- api.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'api.py') diff --git a/api.py b/api.py index 6c960b1..935991d 100644 --- a/api.py +++ b/api.py @@ -132,6 +132,10 @@ class Processor(joblib.worker.Worker): logging.error("%s: deadlocked!", jobid) raise joblib.worker.JobFailed("deadlock", True) # critical + except asyncpg.exceptions.IntegrityConstraintViolationError as err: + logging.error("%s: SQL error '%s'!", jobid, err) + raise joblib.worker.JobFailed({"id": object_id, + "error": str(err)}, True) logging.debug("record processed") if obj_id is not None: -- cgit v1.3.1