JS_ErrorFromException

Get or create JSErrorReport from an exception object.

Syntax

JSErrorReport *
JS_ErrorFromException(JSContext *cx, JS::HandleObject obj);
Name Type Description
cx JSContext * Pointer to a JS context whose errors should be reported via your function. Other contexts in the same runtime can have their own error reporting functions.
obj JS::HandleObject An exception object.

Description

If obj is an exception object, the exception will have (or be able to lazily create) an error report struct, and JS_ErrorFromException will return the address of that struct. Otherwise, it returns nullptr. The lifetime of the error report struct that might be returned is the same as the lifetime of the exception object.

See Also