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.
  • Loading branch information...
Yajo authored and odony committed Nov 13, 2018
1 parent f221936 commit 34a1c674ef440a6501e3f43bc55dd60002e05783
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 34a1c67

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