---
title: "session(_:didFailWithError:)"
framework: gamekit
role: symbol
role_heading: Instance Method
path: "gamekit/gksessiondelegate/session(_:didfailwitherror:)"
---

# session(_:didFailWithError:)

Sent to the delegate when a serious error has occurred in the session.

## Declaration

```swift
optional func session(_ session: GKSession, didFailWithError error: any Error)
```

## Parameters

- `session`: The session that failed.
- `error`: The error that occurred.

## Discussion

Discussion This method is called when a serious internal error occurred in the session. Your application should disconnect the session from other peers and release the session.

## See Also

### Connection Errors

- [session(_:connectionWithPeerFailed:withError:)](gamekit/gksessiondelegate/session(_:connectionwithpeerfailed:witherror:).md)
