From 2fb9bfd97b21ca94d6080278bc5fcd5edbe6ff81 Mon Sep 17 00:00:00 2001 From: Sandy Carter Date: Wed, 12 Nov 2014 23:47:34 -0500 Subject: [PATCH] Don't log SessionExpiredException and TransactionRollbackError --- sentry_logger/odoo_sentry_handler.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sentry_logger/odoo_sentry_handler.py b/sentry_logger/odoo_sentry_handler.py index 04edb951d..9bc6be22d 100644 --- a/sentry_logger/odoo_sentry_handler.py +++ b/sentry_logger/odoo_sentry_handler.py @@ -20,15 +20,26 @@ # ############################################################################### +from psycopg2._psycopg import TransactionRollbackError + from openerp.osv.orm import except_orm from openerp.osv.osv import except_osv +from openerp.addons.web.session import SessionExpiredException from raven.handlers.logging import SentryHandler +odoo_exception_black_list = [ + except_orm, + except_osv, + SessionExpiredException, + TransactionRollbackError, +] + + class OdooSentryHandler(SentryHandler, object): def can_record(self, record): - if record.exc_info and record.exc_info[0] in (except_orm, except_osv): + if record.exc_info and record.exc_info[0] in odoo_exception_black_list: return False if record.module == 'osv' and record.msg == 'Uncaught exception': return False