<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSResponder/presentError(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSResponder(im)presentError:"
  },
  "title" : "presentError(_:)"
}
-->

# presentError(_:)

Presents an error alert to the user as an application-modal dialog.

```
func presentError(_ error: any Error) -> Bool
```

## Parameters

`error`

An object containing information about an error.

## Discussion

The alert displays information found in the <doc://com.apple.documentation/documentation/Foundation/NSError> object `error`; this information can include error description, recovery suggestion, failure reason, and button titles (all localized). The method returns <doc://com.apple.documentation/documentation/Swift/true> if error recovery succeeded and <doc://com.apple.documentation/documentation/Swift/false> otherwise. For error recovery to be attempted, an recovery-attempter object (that is, an object conforming to the `NSErrorRecoveryAttempting` informal protocol) must be associated with `error`.

The default implementation of this method sends [`willPresentError(_:)`](/documentation/AppKit/NSResponder/willPresentError(_:)) to `self`. By doing this, `NSResponder` gives subclasses an opportunity to customize error presentation. It then forwards the message, passing any customized error object, to the next responder; if there is no next responder, it passes the error object to `NSApp`, which displays a document-modal error alert. When the user dismisses the alert, any recovery attempter associated with the error object is given a chance to recover from the error. See the class description for the precise route up the responder chain (plus document and controller objects) this message might travel.

It is not recommended that you attempt to override this method. If you wish to customize the error presentation, override [`willPresentError(_:)`](/documentation/AppKit/NSResponder/willPresentError(_:)) instead.

---

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)