MCPcopy Create free account
hub / github.com/Distributive-Network/PythonMonkey / exceptionHandler

Function exceptionHandler

python/pythonmonkey/cli/pmjs.py:384–394  ·  view source on GitHub ↗

See https://docs.python.org/3.11/library/asyncio-eventloop.html#error-handling-api

(loop, context)

Source from the content-addressed store, hash-verified

382 loop = asyncio.get_running_loop()
383
384 def exceptionHandler(loop, context):
385 "See https://docs.python.org/3.11/library/asyncio-eventloop.html#error-handling-api"
386 error = context["exception"]
387 try:
388 globalInitModule.uncaughtExceptionHandler(error)
389 except SystemExit: # the "exception" raised by `sys.exit()` call
390 pass
391 finally:
392 pm.stop() # unblock `await pm.wait()` to gracefully exit the program
393 nonlocal hasUncaughtException
394 hasUncaughtException = True
395 loop.set_exception_handler(exceptionHandler)
396
397 def cleanupExit(code=0):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected