By default no traceback should be shown for parse errors or validation errors when run from notebook
When running from notebook the behaviour should be (by default) similar to that of running from the CLI, i.e. no traceback being shown for parsing or validation errors.
It should be possible to adjust this behaviour with a flag or so, because we (or power users) would want the traceback for debugging.
Currently the following output is generated.
File:
l laser P=1
s s1 L=1 laser.p1 m1.p1
m m1 R=0.99 T=0.01
Command line:
kat3 parse_test1.kat
PARSING ERROR:
2:19: Got unexpected token m1.p1 of type STRING
s s1 L=1 laser.p1 m1.p1
^
The error message is not sufficient, but at least cleanly displayed.
Notebook
---------------------------------------------------------------------------
KatParserError Traceback (most recent call last)
<ipython-input-94-df96c05019c7> in <module>
6
7 """
----> 8 model = finesse.parse(code)
~/git/simulation/finesse3/finesse/parse/__init__.py in parse(commands, finesse2)
33 k.parse(path=commands)
34 else:
---> 35 k.parse(text=commands)
36 return k.build()
37
~/git/simulation/finesse3/finesse/parse/parser.py in parse(self, text, path)
176 errors = sorted(self.lexer.errors + self.parser.errors, key=lambda tup: tup[1])
177 if len(errors) > 0:
--> 178 raise KatParserError(errors, self.text)
179
180 LOGGER.info("Parsed %s", source)
KatParserError:
3:19: Got unexpected token m1.p1 of type STRING
s s1 L=1 laser.p1 m1.p1
^