<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 8.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/RecoverableError/attemptRecovery(optionIndex:resultHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation16RecoverableErrorP15attemptRecovery11optionIndex13resultHandlerySi_ySbctF"
  },
  "title" : "attemptRecovery(optionIndex:resultHandler:)"
}
-->

# attemptRecovery(optionIndex:resultHandler:)

Attempt to recover from this error when the user selected the
option at the given index. This routine must call handler and
indicate whether recovery was successful (or not).

```
func attemptRecovery(optionIndex recoveryOptionIndex: Int, resultHandler handler: @escaping (Bool) -> Void)
```

## Discussion

This entry point is used for recovery of errors handled at a
“document” granularity, that do not affect the entire
application.

---

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)