Skip to content

Commit 078f1b5

Browse files
authored
Merge pull request #714 from common-workflow-language/bad_type_error
print line number for Avro exceptions when processing input section
2 parents 1b04970 + 0fda304 commit 078f1b5

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

cwltool/process.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -482,23 +482,16 @@ def __init__(self, toolpath_object, **kwargs):
482482
elif key == "outputs":
483483
self.outputs_record_schema["fields"].append(c)
484484

485-
try:
486-
self.inputs_record_schema = cast(Dict[six.text_type, Any], schema_salad.schema.make_valid_avro(self.inputs_record_schema, {}, set()))
485+
with SourceLine(toolpath_object, "inputs", validate.ValidationException):
486+
self.inputs_record_schema = cast(
487+
Dict[six.text_type, Any], schema_salad.schema.make_valid_avro(
488+
self.inputs_record_schema, {}, set()))
487489
AvroSchemaFromJSONData(self.inputs_record_schema, self.names)
488-
except avro.schema.SchemaParseException as e:
489-
raise validate.ValidationException(u"Got error '%s' while "
490-
"processing inputs of %s:\n%s" %
491-
(Text(e), self.tool["id"],
492-
json.dumps(self.inputs_record_schema, indent=4)))
493-
494-
try:
495-
self.outputs_record_schema = cast(Dict[six.text_type, Any], schema_salad.schema.make_valid_avro(self.outputs_record_schema, {}, set()))
490+
with SourceLine(toolpath_object, "outputs", validate.ValidationException):
491+
self.outputs_record_schema = cast(Dict[six.text_type, Any],
492+
schema_salad.schema.make_valid_avro(
493+
self.outputs_record_schema, {}, set()))
496494
AvroSchemaFromJSONData(self.outputs_record_schema, self.names)
497-
except avro.schema.SchemaParseException as e:
498-
raise validate.ValidationException(u"Got error '%s' while "
499-
"processing outputs of %s:\n%s" %
500-
(Text(e), self.tool["id"],
501-
json.dumps(self.outputs_record_schema, indent=4)))
502495

503496
if toolpath_object.get("class") is not None and not kwargs.get("disable_js_validation", False):
504497
if kwargs.get("js_hint_options_file") is not None:

0 commit comments

Comments
 (0)