Skip to content

isExitStatus

isExitStatus(err): boolean

Defined in: packages/runtime/src/wasm/exit-status.ts:36

Check if a thrown value is an Emscripten ExitStatus.

Emscripten’s exit() implementation throws an ExitStatus object (or, in some builds, a bare Error whose message includes the string ExitStatus) to unwind the JS stack after the program calls _Exit. This is normal program termination, not a real error — callers should branch on this check rather than rethrowing.

unknown

Any thrown value.

boolean

true if the value looks like an Emscripten ExitStatus.

try {
module.callMain(args)
} catch (e) {
if (isExitStatus(e)) return getExitStatusCode(e)
throw e
}

getExitStatusCode