shoebot / jupyter-shoebot

Jupyter kernel for running Shoebot scripts
GNU General Public License v3.0
2 stars 1 forks source link

Add clearer tracebacks #1

Open rlafuente opened 6 years ago

rlafuente commented 6 years ago

Right now we have

Traceback (most recent call last):
  File "shoebot_kernel/kernel.py", line 36, in do_execute
    bot.run(code, break_on_error=True)
  File "/home/rlafuente/repos/python-libs/shoebot/shoebot/grammar/grammar.py", line 240, in run
    self._run_frame(executor, limit=frame_limiter, iteration=iteration)
  File "/home/rlafuente/repos/python-libs/shoebot/shoebot/grammar/grammar.py", line 148, in _run_frame
    executor.run()
  File "/home/rlafuente/repos/python-libs/shoebot/shoebot/grammar/livecode.py", line 115, in run
    self.do_exec(self.known_good, self.ns)
  File "/home/rlafuente/repos/python-libs/shoebot/shoebot/grammar/livecode.py", line 82, in do_exec
    exec source in ns
  File "<string>", line 8, in <module>
NameError: name 'red' is not defined

Only the last 2 lines are relevant, and we're also missing context to make it clear which line is problematic.

stuaxo commented 3 years ago

friendly-traceback is a library worth investigating, it lets you skip certain specific which is what's needed here.