amol- / dukpy

Simple JavaScript interpreter for Python
MIT License
479 stars 43 forks source link

Propagating exceptions inside call_python() #74

Open pandasauce opened 1 year ago

pandasauce commented 1 year ago

This is more of a feature request.

Currently, if there is an exception inside a function called with call_python(), it ends up being consumed by dukpy and gets translated into a dukpy.JSRuntimeError.

However, dukpy itself seems to have all the necessary information to just rethrow this exception to the caller of evaljs(), which would be more useful for error handling. If preserving existing behaviour is necessary, maybe it could be an optional argument to evaljs() that is set to False by default.

Is this something that could be added?