Skip to content

Commit a08f4c2

Browse files
illusionalmr-c
andcommitted
Add exception handling to fromwdl
Suggested: PMCC-BioinformaticsCore/janis#58 (review) Co-authored-by: Michael R. Crusoe <[email protected]>
1 parent 2433543 commit a08f4c2

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

janis_core/ingestion/fromwdl.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import re
55
from types import LambdaType
6+
67
from typing import List, Union, Optional, Callable
78
import WDL
89

@@ -447,6 +448,16 @@ def parse_command_tool_output(self, outp: WDL.Decl):
447448

448449
toolname = sys.argv[1]
449450

450-
tool = WdlParser.from_doc(toolname)
451-
452-
tool.translate("janis")
451+
try:
452+
tool = WdlParser.from_doc(toolname)
453+
tool.translate("janis")
454+
455+
except WDL.Error.MultipleValidationErrors as err:
456+
for exc in err.exceptions:
457+
print(exc, file=sys.stderr)
458+
print(exc.pos, file=sys.stderr)
459+
print(exc.node, file=sys.stderr)
460+
except WDL.Error.ValidationError as exc:
461+
print(exc, file=sys.stderr)
462+
print(exc.pos, file=sys.stderr)
463+
print(exc.node, file=sys.stderr)

0 commit comments

Comments
 (0)