Skip to content

Commit

Permalink
Add raise_raw_exception param to execute method
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielguarisa committed Sep 10, 2024
1 parent 22054aa commit 9154187
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "retrack"
version = "2.9.0a2"
version = "2.9.0a3"
description = "A business rules engine"
authors = ["Gabriel Guarisa <[email protected]>"]
license = "MIT"
Expand Down
5 changes: 5 additions & 0 deletions retrack/engine/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ def execute(
self,
payload_df: pd.DataFrame,
debug_mode: bool = False,
raise_raw_exception: bool = False,
context: typing.Optional[registry.Registry] = None,
) -> typing.Union[
pd.DataFrame, typing.Tuple[Execution, typing.Optional[Exception]]
Expand All @@ -213,6 +214,7 @@ def execute(
Args:
payload_df (pd.DataFrame): The payload to be executed.
debug_mode (bool, optional): If True, runs the rule in debug mode and returns the exception, if any. Defaults to False.
raise_raw_exception (bool, optional): If True, raises the raw exception. Defaults to False.
context (registry.Registry, optional): Global constants to be used during execution. Defaults to None.
Raises:
Expand Down Expand Up @@ -240,6 +242,9 @@ def execute(
try:
self.__run_node(node_id, execution=execution)
except Exception as e:
if raise_raw_exception:
raise e

msg = None
if isinstance(e, exceptions.ExecutionException):
msg = "Error executing a sub-rule node {} from rule {} version {}".format(
Expand Down

0 comments on commit 9154187

Please sign in to comment.