Skip to content
Permalink
Browse files

[FIX] core: log unexpected validation exceptions

Before this patch, any exception raised by a constraint method that
were not of type `ValidationError` were hard to debug, because the
origin line was never logged.

Explicitly logging the error (with traceback) when we catch it
ensures proper contextual info, even in the absence of exception
chaining.

closes #28612
  • Loading branch information...
Yajo authored and odony committed Nov 13, 2018
1 parent 6cf4f49 commit 2b1d3ff82dd23fb0372b3b73ecb84841a0d593d3
Showing with 1 addition and 0 deletions.
  1. +1 −0 odoo/models.py
@@ -1079,6 +1079,7 @@ def _validate_fields(self, field_names):
except ValidationError, e:
raise
except Exception, e:
_logger.exception('Exception while validating constraint')
raise ValidationError("%s\n\n%s" % (_("Error while validating constraint"), tools.ustr(e)))

@api.model

0 comments on commit 2b1d3ff

Please sign in to comment.
You can’t perform that action at this time.