From e7dd481bae14b4944aec4eca0e99544183ac582e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 25 Oct 2016 23:29:19 +0200 Subject: [PATCH] Catch also KeyError when formatting error message When error message uses key formatting, KeyError could also be raised if a key is missing in the dictionary. issue5956 review34381002 --- trytond/error.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trytond/error.py b/trytond/error.py index 97a86bdf06..44995c0e12 100644 --- a/trytond/error.py +++ b/trytond/error.py @@ -45,7 +45,7 @@ class WarningErrorMixin(object): if error_args is not None: try: error = error % error_args - except TypeError: + except (TypeError, KeyError): pass if error_description: @@ -64,7 +64,7 @@ class WarningErrorMixin(object): try: error_description = (error_description % error_description_args) - except TypeError: + except (TypeError, KeyError): pass if raise_exception: raise UserError(error, error_description)