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

# cancelProxyWithError(_:)

Cancels the DNS proxy.

## Declaration

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

## Parameters

- `error`: An error instance containing details about the problem that the proxy provider implementation encountered.

## Discussion

Discussion Call this method from within the proxy provider when you need to stop the proxy due to a network error that renders the proxy no longer viable. important: Subclasses should not override this method.

## See Also

### Managing the DNS proxy life cycle

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