---
title: "finishRunningWithError(_:)"
framework: automator
role: symbol
role_heading: Instance Method
path: "automator/amaction/finishrunningwitherror(_:)"
---

# finishRunningWithError(_:)

Causes the action to stop running and return an error, which, in turn, causes the workflow to stop.

## Declaration

```swift
func finishRunningWithError(_ error: (any Error)?)
```

## Parameters

- `error`: The error to be returned to Automator.

## Discussion

Discussion Call this method on any action that overrides runAsynchronously(withInput:) in order to make asynchronous calls. When finishRunningWithError(_:) is invoked, it immediately calls willFinishRunning().

## See Also

### Controlling the Action

- [run(withInput:)](automator/amaction/run(withinput:).md)
- [runAsynchronously(withInput:)](automator/amaction/runasynchronously(withinput:).md)
- [willFinishRunning()](automator/amaction/willfinishrunning().md)
- [stop()](automator/amaction/stop().md)
- [reset()](automator/amaction/reset().md)
