<!--
{
  "documentType" : "article",
  "framework" : "ExceptionHandling",
  "identifier" : "/documentation/ExceptionHandling/logging-and-handling-constants",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Logging and Handling Constants"
}
-->

# Logging and Handling Constants

Use one or more of the following constants in the parameter of [`setExceptionHandlingMask(_:)`](/documentation/ExceptionHandling/NSExceptionHandler/setExceptionHandlingMask(_:))
to specify the types of exceptions that the exception handler should monitor and
whether it should handle or log them.

## Overview

When exception-handling domains are nested, [`NSLogTopLevelExceptionMask`](/documentation/ExceptionHandling/NSLogTopLevelExceptionMask)
and [`NSHandleTopLevelExceptionMask`](/documentation/ExceptionHandling/NSHandleTopLevelExceptionMask) deal with exceptions that
would make it to the top two levels of exception handlers. In the main thread of
a Cocoa application, the top-level handler is the global <doc://com.apple.documentation/documentation/AppKit/NSApplication>
instance.

## Topics

### Constants

[`NSLogUncaughtExceptionMask`](/documentation/ExceptionHandling/NSLogUncaughtExceptionMask)

The exception handler logs uncaught exceptions.

[`NSHandleUncaughtExceptionMask`](/documentation/ExceptionHandling/NSHandleUncaughtExceptionMask)

The exception handler handles uncaught exceptions by terminating the thread in which
they occur.

[`NSLogUncaughtSystemExceptionMask`](/documentation/ExceptionHandling/NSLogUncaughtSystemExceptionMask)

The exception handler logs uncaught system exceptions.

[`NSHandleUncaughtSystemExceptionMask`](/documentation/ExceptionHandling/NSHandleUncaughtSystemExceptionMask)

The exception handler handles uncaught system exceptions by converting them to <doc://com.apple.documentation/documentation/Foundation/NSException>
objects containing a stack trace.

[`NSLogUncaughtRuntimeErrorMask`](/documentation/ExceptionHandling/NSLogUncaughtRuntimeErrorMask)

The exception handler logs uncaught runtime errors.

[`NSHandleUncaughtRuntimeErrorMask`](/documentation/ExceptionHandling/NSHandleUncaughtRuntimeErrorMask)

The exception handler handles uncaught runtime errors by converting them to <doc://com.apple.documentation/documentation/Foundation/NSException>
objects containing a stack trace.

[`NSLogTopLevelExceptionMask`](/documentation/ExceptionHandling/NSLogTopLevelExceptionMask)

The exception handler logs exceptions that would be caught by the top-level handler.

[`NSHandleTopLevelExceptionMask`](/documentation/ExceptionHandling/NSHandleTopLevelExceptionMask)

The exception handler handles exceptions caught by the top-level handler by converting
them to <doc://com.apple.documentation/documentation/Foundation/NSException> objects
containing a stack trace.

[`NSLogOtherExceptionMask`](/documentation/ExceptionHandling/NSLogOtherExceptionMask)

The exception handler logs exceptions caught by handlers lower than the top-level
handler.

[`NSHandleOtherExceptionMask`](/documentation/ExceptionHandling/NSHandleOtherExceptionMask)

The exception handler handles exceptions caught by handlers lower than the top-level
handler by converting them to <doc://com.apple.documentation/documentation/Foundation/NSException>
objects containing a stack trace.

### Containing Objective-C enumeration



---

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)