sciter-sdk / pysciter

Python bindings for Sciter
https://sciter.com
MIT License
397 stars 40 forks source link

Added optional exception callback function to EventHandler #53

Closed AlecHaring closed 2 years ago

AlecHaring commented 2 years ago

The script_call_exception_handler kwarg for the EventHandler class can be used to pass in a function that will be called when an exception occurs inside a script call.

Example:

def exception_handler(func_name, script_exc):
    logger.exception(f"An error has occurred in {func_name}: {str(script_exc)}", exc_info=script_exc)

event_handler = sciter.EventHandler(window=frame, script_call_exception_handler=exception_handler)