Skip to content

Commit

Permalink
[FIX] reraise __cause__ of the CodeEvaluationError if it exists as we…
Browse files Browse the repository at this point in the history
… want the final exception before CodeEvaluationError and not the root one
  • Loading branch information
benwillig committed Jul 5, 2024
1 parent b76a14c commit fc43145
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions statechart/models/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@
from sismic.interpreter import Interpreter as SismicInterpreter
from sismic.model import Event

from odoo.exceptions import except_orm


def _root_cause(e):
if isinstance(e, except_orm):
return e
if not hasattr(e, "__cause__") or not e.__cause__:
return e
return _root_cause(e.__cause__)
cause_exc = getattr(e, "__cause__", False)
if cause_exc:
return cause_exc
return e


class Interpreter(SismicInterpreter):
Expand Down

0 comments on commit fc43145

Please sign in to comment.