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.
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:
nexus-forge/kgforge/core/commons/execution.py
Lines 170 to 171 in 8a900ec
I traced the code and the
catch_exceptionsflag is set toTrueby default:nexus-forge/kgforge/core/commons/execution.py
Lines 110 to 113 in 8a900ec
And there seems to be no way to change it's value, since the public API of the
Storedoes not allow for this argument to be passed, for example:nexus-forge/kgforge/core/archetypes/store.py
Lines 99 to 112 in 8a900ec
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.