Skip to content

Commit e47f4e6

Browse files
committed
Improve debugging: missing filename and bad lists
These are debugging helpers for problematic CWL inputs, helping with ongoing work debugging CWL Toil runs on AWS. - Avoids failing on LineCol inputs that do not have file and position references. Without this in place the missing `filename` and None attributes for `line` and `col` obscure the real error message. Fixes #264 - Prints out value of a CWL data item that is not an expected list.
1 parent bee8bf1 commit e47f4e6

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

schema_salad/sourceline.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,13 @@ def makeError(self, msg): # type: (Text) -> Any
150150
return self.raise_type(msg)
151151
errs = []
152152
if self.key is None or self.item.lc.data is None or self.key not in self.item.lc.data:
153-
lead = "%s:%i:%i:" % (self.item.lc.filename,
154-
self.item.lc.line+1,
155-
self.item.lc.col+1)
153+
lead = "%s:%i:%i:" % (self.item.lc.filename if hasattr(self.item.lc, "filename") else "",
154+
(self.item.lc.line or 0)+1,
155+
(self.item.lc.col or 0)+1)
156156
else:
157-
lead = "%s:%i:%i:" % (self.item.lc.filename,
158-
self.item.lc.data[self.key][0]+1,
159-
self.item.lc.data[self.key][1]+1)
157+
lead = "%s:%i:%i:" % (self.item.lc.filename if hasattr(self.item.lc, "filename") else "",
158+
(self.item.lc.data[self.key][0] or 0)+1,
159+
(self.item.lc.data[self.key][1] or 0)+1)
160160
for m in msg.splitlines():
161161
if lineno_re.match(m):
162162
errs.append(m)

schema_salad/validate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ def validate_ex(expected_schema, # type: Schema
180180
return True
181181
else:
182182
if raise_ex:
183-
raise ValidationException(u"the value is not a list, expected list of %s" % (
184-
friendly(expected_schema.items)))
183+
raise ValidationException(u"the value %s is not a list, expected list of %s" % (
184+
vpformat(datum), friendly(expected_schema.items)))
185185
else:
186186
return False
187187
elif isinstance(expected_schema, avro.schema.UnionSchema):

0 commit comments

Comments
 (0)