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
This commit is contained in:
Cédric Krier committed 2016-10-25 23:29:19 +02:00
1 parent 77815c88bd
commit e7dd481bae
1 file changed
+2 -2
+2 -2
View File
@@ -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)