---
title: "workflowController(_:didError:)"
framework: automator
role: symbol
role_heading: Instance Method
path: "automator/amworkflowcontrollerdelegate/workflowcontroller(_:diderror:)"
---

# workflowController(_:didError:)

Notifies the delegate when the workflow encounters an error.

## Declaration

```swift
optional func workflowController(_ controller: AMWorkflowController, didError error: any Error)
```

## Parameters

- `controller`: The controller object sending the message.
- `error`: If a workflow error occurs, upon return contains an instance of doc://com.apple.documentation/documentation/Foundation/NSError that describes the problem.
