We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE

JS ReportPendingException

Forward the current pending exception in a given JSContext to the current JSErrorReporter callback.


JSBool JS_ReportPendingException(JSContext *cx);
Name Type Description
cx JSContext * The context in which the exception was thrown. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.


If an exception is pending in the context cx, JS_ReportPendingException converts the exception to a string and reports it to the current error reporter.

On success, it clears the exception as though by calling JS_ClearPendingException and returns JS_TRUE. If no exception is pending, or if a second error occurs while trying to report the first one, it returns JS_FALSE.

This function can be used to catch exceptions thrown from scripts and send them to the error reporter to be logged or ignored. Note that certain JSAPI functions automatically do this for uncaught exceptions; see "Automatic handling of uncaught exceptions" in the JSAPI User Guide.

MXR ID Search for JS_ReportPendingException

Document Tags and Contributors

 Last updated by: Jorend,