---
title: NSGetUncaughtExceptionHandler()
framework: foundation
role: symbol
role_heading: Function
path: foundation/nsgetuncaughtexceptionhandler()
---

# NSGetUncaughtExceptionHandler()

Returns the top-level error handler.

## Declaration

```swift
func NSGetUncaughtExceptionHandler() -> ((NSException) -> Void)?
```

## Return Value

Return Value A pointer to the top-level error-handling function where you can perform last-minute logging before the program terminates.

## See Also

### Related Documentation

- [NSSetUncaughtExceptionHandler(_:)](foundation/nssetuncaughtexceptionhandler(_:).md)

### Functions

- [NSSetUncaughtExceptionHandler(_:)](foundation/nssetuncaughtexceptionhandler(_:).md)
