Skip to content

Commit 8d85120

Browse files
authored
report the line number for substitution errors (#1154)
1 parent 0e98de8 commit 8d85120

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

cwltool/validate_js.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
from schema_salad.validate import Schema # pylint: disable=unused-import
1616
from schema_salad.validate import validate_ex
1717

18+
from .errors import WorkflowException
1819
from .expression import scanner as scan_expression
20+
from .expression import SubstitutionError
1921
from .loghandler import _logger
2022
from .sandboxjs import code_fragment_to_js, exec_js_process
2123
from .utils import json_dumps
@@ -184,7 +186,14 @@ def validate_js_expressions(tool, schema, jshint_options=None):
184186

185187
for expression, source_line in expressions:
186188
unscanned_str = expression.strip()
187-
scan_slice = scan_expression(unscanned_str)
189+
try:
190+
scan_slice = scan_expression(unscanned_str)
191+
except SubstitutionError as se:
192+
if source_line:
193+
source_line.raise_type = WorkflowException
194+
raise source_line.makeError(str(se))
195+
else:
196+
raise se
188197

189198
while scan_slice:
190199
if unscanned_str[scan_slice[0]] == '$':

0 commit comments

Comments
 (0)