Instance Property

exceptionHandler

A block to be invoked should evaluating a script result in a JavaScript exception being thrown.

Declaration

@property(copy) void (^exceptionHandler)(JSContext *context, JSValue *exception);

Discussion

The block takes the following parameters:

context

The context in which the exception originates.

exception

The JavaScript exception thrown.

The default value exception handler block stores its exception parameter value into the context’s exception property. As a consequence, the default behavior is that unhandled exceptions occurring within a callback from JavaScript to native code are thrown again upon return. Setting this value to nil results in all uncaught exceptions being silently consumed.

See Also

Working with JavaScript Global State

globalObject

The JavaScript global object associated with the context.

exception

A JavaScript exception to be thrown in evaluation of the script.

virtualMachine

The JavaScript virtual machine to which the context belongs.

name

A descriptive name for the context.