Any unhandled exception raised inside Python causes the corresponding awaitedDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Crane04/esem/llms.txt
Use this file to discover all available pages before exploring further.
Promise to reject with a PythonError. The error carries the original exception message, the Python exception class name, and the full formatted traceback — everything you need to diagnose what went wrong on the Python side without switching runtimes.
Class definition
Properties
The Python exception message — the string argument passed to the exception constructor (e.g.
"Input cannot be empty").A formatted string identifying the Python exception type:
"PythonError(ErrorType)", where ErrorType is the unqualified Python exception class name. Examples: "PythonError(ValueError)", "PythonError(TypeError)", "PythonError(KeyError)". If the type cannot be determined, the value is "PythonError".The full formatted Python traceback as a single string, identical to what Python prints to stderr. Useful for pinpointing the exact file, line number, and call stack where the exception originated.
Always
true. Provides a reliable, duck-typed way to distinguish PythonError instances from other errors in catch blocks without importing the class — e.g. if (err.isPythonError).Catching a PythonError
Test verification
The following test from the esem-bridge test suite verifies that Python error details are preserved faithfully across the bridge:PythonError extends the native Error class, so it works with every standard JavaScript error-handling pattern: try/catch, Promise.catch(), assert.rejects(), instanceof checks, and error-monitoring libraries that inspect the Error prototype chain.Worker crash errors
If the Python worker process exits unexpectedly — for example because it was killed by the OS or crashed due to an unrecoverable error — all pendingPromises reject with a plain Error, not a PythonError:
Error will not satisfy err instanceof PythonError or err.isPythonError. Guard against it by checking err.isPythonError (or instanceof PythonError) before accessing pythonTraceback: