BlueBrain / nexus-forge

Building and Using Knowledge Graphs made easy
https://nexus-forge.readthedocs.io
GNU Lesser General Public License v3.0
38 stars 20 forks source link

Propagating exceptions from executed actions #371

Open kshalot opened 6 months ago

kshalot commented 6 months ago

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: https://github.com/BlueBrain/nexus-forge/blob/8a900ecf191b14490e7c85254d2c41cf2ec5c8a6/kgforge/core/commons/execution.py#L170-L171

I traced the code and the catch_exceptions flag is set to True by default: https://github.com/BlueBrain/nexus-forge/blob/8a900ecf191b14490e7c85254d2c41cf2ec5c8a6/kgforge/core/commons/execution.py#L110-L113

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: https://github.com/BlueBrain/nexus-forge/blob/8a900ecf191b14490e7c85254d2c41cf2ec5c8a6/kgforge/core/archetypes/store.py#L99-L112

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 https://github.com/BlueBrain/nexus-forge/pull/281 adds a way to manipulate this behaviour, although only for "debug" purposes and the PR is not merged.