---
title: exceptionHandler
framework: javascriptcore
role: symbol
role_heading: Instance Property
path: javascriptcore/jscontext/exceptionhandler
---

# exceptionHandler

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

## Declaration

```swift
var exceptionHandler: ((JSContext?, JSValue?) -> Void)! { get set }
```

## Discussion

Discussion The block takes the following parameters: 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](javascriptcore/jscontext/globalobject.md)
- [exception](javascriptcore/jscontext/exception.md)
- [virtualMachine](javascriptcore/jscontext/virtualmachine.md)
- [name](javascriptcore/jscontext/name.md)
