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

# taskViewController(_:didEncounterError:)

Called 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

- `viewController`: The view controller in which the error was encountered.
- `didEncounterError`: The error that was unhandled.
