---
title: "cancelProxyWithError(_:)"
framework: networkextension
role: symbol
role_heading: Instance Method
path: "networkextension/neappproxyprovider/cancelproxywitherror(_:)"
---

# cancelProxyWithError(_:)

Stop the network proxy from the App Proxy Provider.

## Declaration

```swift
func cancelProxyWithError(_ error: (any Error)?)
```

## Parameters

- `error`: An doc://com.apple.documentation/documentation/Foundation/NSError object containing the error that caused the proxy to be stopped. The domain and code of this NSError object is defined by the caller.

## Discussion

Discussion The App Proxy Provider should call this method when an unrecoverable error occurs that makes the proxy no longer viable.

## See Also

### Managing the app proxy life cycle

- [startProxy(options:completionHandler:)](networkextension/neappproxyprovider/startproxy(options:completionhandler:).md)
- [stopProxy(with:completionHandler:)](networkextension/neappproxyprovider/stopproxy(with:completionhandler:).md)
