PetterS / quickjs

Thin Python wrapper of https://bellard.org/quickjs/
https://github.com/bellard/QuickJS
MIT License
179 stars 19 forks source link

More verbose exceptions in callables #63

Open qwenger opened 3 years ago

qwenger commented 3 years ago

When an exception happens in a Python callable added via (Context|Function).add_callable, the error message is not specific, which makes it hard to debug.

Of course, one could wrap each callable in a try/except block, but that's tedious.

I understand that the error cannot really be raised directly to Python, as it has to go through the JS machinery, thereby losing most of the exception stack. But maybe one could at least write the traceback to stderr, eg. using PyErr_WriteUnraisable?

This seems to be the way adopted by CFFI in absence of a specific handler.