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

# taskViewController(_:didEncounterError:)

Notifies the delegate when an unhandled error is encountered in a task view controller.

## Declaration

```swift
func taskViewController<C, VS>(_ viewController: OCKTaskViewController<C, VS>, didEncounterError: Error) where C : OCKTaskControllerProtocol, VS : OCKTaskViewSynchronizerProtocol
```

## Parameters

- `taskViewController`: The task view controller that the error occurred in.
- `error`: The error that occurred.
