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

# presentError(_:)

Presents an error alert to the user as a modal panel.

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

## Parameters

`error`

The error object encapsulating the information to present to the user.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if error recovery was done; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

This method does not return until the user dismisses the alert and, if the error has recovery options and a recovery delegate, the error’s recovery delegate  is sent an <doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class/attemptRecovery(fromError:optionIndex:)> message.

The `NSDocument` default implementation of this method is equivalent to that of `NSResponder` and treats the shared `NSDocumentController` as the next responder and forwards these messages to it.

The default implementation of this method invokes [`willPresentError(_:)`](/documentation/AppKit/NSDocument/willPresentError(_:)) to give subclasses an opportunity to customize error presentation. You should not override this method but should instead override [`willPresentError(_:)`](/documentation/AppKit/NSDocument/willPresentError(_:)).

---

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)