<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "ObjectiveC",
  "identifier" : "/documentation/ObjectiveC/NSObject-swift.class/exceptionHandler(_:shouldLogException:mask:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Objective-C Runtime",
      "ObjectiveC"
    ],
    "preciseIdentifier" : "c:objc(cs)NSObject(im)exceptionHandler:shouldLogException:mask:"
  },
  "title" : "exceptionHandler(_:shouldLogException:mask:)"
}
-->

# exceptionHandler(_:shouldLogException:mask:)

Implemented by the delegate to evaluate whether the delegating exception hangler should log a given exception.

```
func exceptionHandler(_ sender: NSExceptionHandler!, shouldLogException exception: NSException!, mask aMask: Int) -> Bool
```

## Parameters

`sender`

The <doc://com.apple.documentation/documentation/ExceptionHandling/NSExceptionHandler> object sending the message.

`exception`

An <doc://com.apple.documentation/documentation/Foundation/NSException> object describing the exception to be evaluated.

`aMask`

The bit mask indicating the types of exceptions logged by the <doc://com.apple.documentation/documentation/ExceptionHandling/NSExceptionHandler> object. See Logging and Handling Constants and System Hang Constants for descriptions of the possible `enum` constants.

## Return Value

[`YES`](/documentation/ObjectiveC/YES) to have the <doc://com.apple.documentation/documentation/ExceptionHandling/NSExceptionHandler> object log the exception, [`NO`](/documentation/ObjectiveC/NO) otherwise.

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)