---
title: "onThrow(error:)"
framework: distributed
role: symbol
role_heading: Instance Method
path: "distributed/distributedtargetinvocationresulthandler/onthrow(error:)"
---

# onThrow(error:)

Invoked when the distributed target execution of a target has thrown an error.

## Declaration

```swift
func onThrow<Err>(error: Err) async throws where Err : Error
```

## Discussion

Discussion It is not guaranteed that the error conform to the SerializationRequirement; This guarantee is only given to return values (and offered by onReturn).
