---
title: "finishBroadcastWithError(_:)"
framework: replaykit
role: symbol
role_heading: Instance Method
path: "replaykit/rpbroadcastsamplehandler/finishbroadcastwitherror(_:)"
---

# finishBroadcastWithError(_:)

Stops the broadcast and passes an error back to the broadcasting app.

## Declaration

```swift
func finishBroadcastWithError(_ error: any Error)
```

## Parameters

- `error`: An NSError object that is passed back to the broadcasting app through the doc://com.apple.replaykit/documentation/ReplayKit/RPBroadcastControllerDelegate/broadcastController(_:didFinishWithError:) method.

## Discussion

Discussion Call this method in your sample handler when it cannot proceed due to an error.

## See Also

### Handling Sample Buffer Clips

- [broadcastStarted(withSetupInfo:)](replaykit/rpbroadcastsamplehandler/broadcaststarted(withsetupinfo:).md)
- [broadcastPaused()](replaykit/rpbroadcastsamplehandler/broadcastpaused().md)
- [broadcastResumed()](replaykit/rpbroadcastsamplehandler/broadcastresumed().md)
- [broadcastFinished()](replaykit/rpbroadcastsamplehandler/broadcastfinished().md)
- [broadcastAnnotated(withApplicationInfo:)](replaykit/rpbroadcastsamplehandler/broadcastannotated(withapplicationinfo:).md)
- [RPApplicationInfoBundleIdentifierKey](replaykit/rpapplicationinfobundleidentifierkey.md)
- [processSampleBuffer(_:with:)](replaykit/rpbroadcastsamplehandler/processsamplebuffer(_:with:).md)
- [RPVideoSampleOrientationKey](replaykit/rpvideosampleorientationkey.md)
