---
title: "cancelRequest(withError:)"
framework: fileproviderui
role: symbol
role_heading: Instance Method
path: "fileproviderui/fpuiactionextensioncontext/cancelrequest(witherror:)"
---

# cancelRequest(withError:)

Cancels the action and returns the provided error.

## Declaration

```swift
func cancelRequest(withError error: any Error)
```

## Mentioned in

Adding Actions to the Context Menu

## Discussion

Discussion Call this method if the action fails. Set the error’s domain to FPUIErrorDomain. Set the error code to a FPUIExtensionErrorCode value.

## See Also

### Completing the Action

- [completeRequest()](fileproviderui/fpuiactionextensioncontext/completerequest().md)
