Skip to content

Commit 7e7b91a

Browse files
committed
print line number for Avro exceptions
1 parent 0c8e2ee commit 7e7b91a

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

cwltool/process.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -482,23 +482,17 @@ 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",
486+
avro.schema.SchemaParseException):
487+
self.inputs_record_schema = cast(
488+
Dict[six.text_type, Any], schema_salad.schema.make_valid_avro(
489+
self.inputs_record_schema, {}, set()))
487490
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()))
491+
with SourceLine(toolpath_object, "outputs", avro.schema.SchemaParseException):
492+
self.outputs_record_schema = cast(Dict[six.text_type, Any],
493+
schema_salad.schema.make_valid_avro(
494+
self.outputs_record_schema, {}, set()))
496495
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)))
502496

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

0 commit comments

Comments
 (0)