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

# willNotPresentError(_:)

Confirms that the error object is not to be presented to the user and the error cannot be recovered from, so cleanup can be done.

```
func willNotPresentError(_ error: any Error)
```

## Parameters

`error`

An <doc://com.apple.documentation/documentation/Foundation/NSError> object returned by another `NSDocument` method.

## Discussion

Some `NSDocument` methods, like those involved in writing, may not immediately delete temporary files if there is a chance that the error can be recovered from and the operation can continue. To make sure that cleanup is always done, you should invoke this method with `NSDocument` errors that are not going to be passed to one of the `presentError:...` methods. For example, the `NSDocument` implementation of the `NSFilePresenter` method <doc://com.apple.documentation/documentation/Foundation/NSFilePresenter/savePresentedItemChanges(completionHandler:)> invokes this method when it invokes [`autosave(withImplicitCancellability:completionHandler:)`](/documentation/AppKit/NSDocument/autosave(withImplicitCancellability:completionHandler:)) and the completion handler is passed an `NSError` object, because it does not present the error to the user.

---

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)