You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The error message that is provided for a bad range expression for an INT type task parameter does not currently help the end-user understand what actually went wrong. For example, given:
It points to the right place, but doesn't help someone understand what went wrong. Note that this is different from, say, making a syntax error like range: "1-10:2;10" which produces the error:
There is a better error available, but it is not being surfaced:
% python
Python 3.9.6 (default, Feb 3 2024, 15:58:27)
[Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import openjd.model._range_expr as r
>>> r1 = r.IntRange(1,10,1)
>>> r2 = r.IntRange(10,10,1)
>>> range_expr = r.IntRangeExpr([r1,r2])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/neilsd/.venv/lib/python3.9/site-packages/openjd/model/_range_expr.py", line 49, in __init__
self._validate()
File "/Users/neilsd/.venv/lib/python3.9/site-packages/openjd/model/_range_expr.py", line 153, in _validate
raise ValueError(
ValueError: Range expression is not valid due to overlapping ranges:
1-10 overlaps with 10
Proposed Solution
Modify the model validation so that the internal ValueError's message is surfaced rather than the generic "Failed to create IntRangeExpr". i.e. The output should be:
% openjd check expr.template.yaml
ERROR: 'expr.template.yaml' failed checks: 1 validation errors for JobTemplate
steps[0] -> parameterSpace -> taskParameterDefinitions[0] -> range:
Not valid due to overlapping ranges: 1-10 overlaps with 10
The text was updated successfully, but these errors were encountered:
Use Case
The error message that is provided for a bad range expression for an INT type task parameter does not currently help the end-user understand what actually went wrong. For example, given:
The error that we get from validation is:
It points to the right place, but doesn't help someone understand what went wrong. Note that this is different from, say, making a syntax error like
range: "1-10:2;10"
which produces the error:There is a better error available, but it is not being surfaced:
Proposed Solution
Modify the model validation so that the internal ValueError's message is surfaced rather than the generic "Failed to create IntRangeExpr". i.e. The output should be:
The text was updated successfully, but these errors were encountered: