<!--
{
  "availability" : [
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSUserScriptTask/CompletionHandler",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@T@NSUserScriptTaskCompletionHandler"
  },
  "title" : "NSUserScriptTask.CompletionHandler"
}
-->

# NSUserScriptTask.CompletionHandler

Implement this block to retrieve the error of the script executed by [`execute(completionHandler:)`](/documentation/Foundation/NSUserScriptTask/execute(completionHandler:)).

```
typealias CompletionHandler = @Sendable ((any Error)?) -> Void
```

---

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)