Skip to content

Commit 68ac569

Browse files
committed
feat: add better logging when a parsing error occurs
1 parent 9d94538 commit 68ac569

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

arkdoc/generator/utils.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,18 @@ def from_txt(doc: Documentation) -> spec.Function:
115115

116116

117117
def documentation_to_specification(doc: Documentation) -> spec.Function:
118-
if doc.source == Source.ArkScript:
119-
return from_ark(doc)
120-
elif doc.source == Source.Cpp:
121-
return from_cpp(doc)
122-
elif doc.source == Source.Txt:
123-
return from_txt(doc)
124-
else:
125-
raise NotImplementedError
118+
try:
119+
if doc.source == Source.ArkScript:
120+
return from_ark(doc)
121+
elif doc.source == Source.Cpp:
122+
return from_cpp(doc)
123+
elif doc.source == Source.Txt:
124+
return from_txt(doc)
125+
except ValueError as e:
126+
logger.error(f"While parsing file {doc.source}, got an error")
127+
try:
128+
logger.error(str(doc))
129+
except Exception:
130+
logger.warn("Couldn't print the signature of the function")
131+
raise e
132+
raise NotImplementedError

0 commit comments

Comments
 (0)