Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagating exceptions from executed actions #371

Open
kshalot opened this issue Jan 15, 2024 · 0 comments
Open

Propagating exceptions from executed actions #371

kshalot opened this issue Jan 15, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@kshalot
Copy link

kshalot commented Jan 15, 2024

Hello!

Issue

I noticed that whenever an action fails, regardless of the cause, the exception is always silenced and logged with a simple print. I traced the implementation and found that this behaviour is controlled by the following logic:

Current API

The exceptions are only re-raised if the following conditions are met:

if not catch_exceptions and exception:
raise exception

I traced the code and the catch_exceptions flag is set to True by default:

def run(fun_one: Callable, fun_many: Optional[Callable], data: Union[Resource, List[Resource]],
exception: Type[RunException], id_required: bool = False,
required_synchronized: Optional[bool] = None, execute_actions: bool = False,
monitored_status: Optional[str] = None, catch_exceptions: bool = True, **kwargs) -> None:

And there seems to be no way to change it's value, since the public API of the Store does not allow for this argument to be passed, for example:

def register(
self, data: Union[Resource, List[Resource]], schema_id: str = None
) -> None:
# Replace None by self._register_many to switch to optimized bulk registration.
run(
self._register_one,
None,
data,
required_synchronized=False,
execute_actions=True,
exception=RegistrationError,
monitored_status="_synchronized",
schema_id=schema_id,
)

Is there something I'm missing or is there currently no way to allow the exceptions to propagate normally? Is this a conscious decision? I found that #281 adds a way to manipulate this behaviour, although only for "debug" purposes and the PR is not merged.

@ssssarah ssssarah added the enhancement New feature or request label Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants