---
title: "handleCancellation(error:)"
framework: xpc
role: symbol
role_heading: Instance Method
path: "xpc/xpcpeerhandler/handlecancellation(error:)"
---

# handleCancellation(error:)

A closure the system invokes when it cancels a session with a client.

## Declaration

```swift
func handleCancellation(error: XPCRichError)
```

## Parameters

- `error`: A description of the reason for the session’s cancellation.
