---
title: "remoteObjectProxyWithErrorHandler(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsxpcproxycreating/remoteobjectproxywitherrorhandler(_:)"
---

# remoteObjectProxyWithErrorHandler(_:)

Returns a proxy object that invokes the error handling block if an error occurs on the connection.

## Declaration

```swift
func remoteObjectProxyWithErrorHandler(_ handler: @escaping @Sendable (any Error) -> Void) -> Any
```

## Parameters

- `handler`: The error handling block that the proxy object should call when an error occurs while waiting for a reply.

## Discussion

Discussion If the message sent to the proxy has a reply handler, then either the error handler or the reply handler is called exactly once. The resulting proxy object conforms to the NSXPCProxyCreating protocol.
