fix: catch ValueError and ZeroDivision errors on early jexl evaluation #2027
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently, starting a new case fails if any of the JEXL evaluations in a form return a
ZeroDivisionError
in the signal layer.Fix
Add
ValueError
andZeroDivisionError
to catch block around JEXL evaluation in signal layer.More detailed description
We evaluate JEXL expressions greedily in the signal layer, but do so without raising:
caluma/caluma/caluma_form/signals.py
Line 104 in 7125c6a
However, in the
jexl.update
function we only catchTypeError
:caluma/caluma/caluma_form/jexl.py
Line 201 in 7125c6a
This is also not consistent with the catch block here, where we catch
TypeError
,ValueError
andZeroDivisionError
:caluma/caluma/caluma_core/jexl.py
Line 81 in 7125c6a
This fix is time-critical as it is currently not possible to start a certain form which uses many calculated fields.