---
title: "chartViewController(_:didEncounterError:)"
framework: CareKit
role: symbol
role_heading: Instance Method
platforms: [iOS 13.0+, Mac Catalyst 13.0+, watchOS 7.0+]
path: "carekit/ockchartviewcontrollerdelegate/chartviewcontroller(_:didencountererror:)"
---

# chartViewController(_:didEncounterError:)

Notifies the delegate of an unhandled error in a chart view controller.

## Declaration

```swift
func chartViewController<C, VS>(_ viewController: OCKChartViewController<C, VS>, didEncounterError: Error) where C : OCKChartControllerProtocol, VS : OCKChartViewSynchronizerProtocol
```

## Parameters

- `viewController`: The view controller in which the error occurred.
- `didEncounterError`: The error that occurred.
