From c0167896ff0acf2e8b5cc334bd851fe64f673ef5 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Fri, 28 Nov 2014 09:57:44 +0100 Subject: [PATCH] More concrete exception. --- cron_run_manually/ir_cron.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cron_run_manually/ir_cron.py b/cron_run_manually/ir_cron.py index 7b5ba8133..7dc7eea6c 100644 --- a/cron_run_manually/ir_cron.py +++ b/cron_run_manually/ir_cron.py @@ -20,7 +20,7 @@ import logging from openerp import _, api, exceptions, models, SUPERUSER_ID from openerp.tools.safe_eval import safe_eval - +from psycopg2 import OperationalError _logger = logging.getLogger(__name__) @@ -49,7 +49,7 @@ class Cron(models.Model): (self.id,), log_exceptions=False) - except Exception as e: + except OperationalError as e: # User friendly error if the lock could not be claimed if getattr(e, "pgcode", None) == '55P03': raise exceptions.Warning(