---
title: "stream(_:didStopWithError:)"
framework: screencapturekit
role: symbol
role_heading: Instance Method
path: "screencapturekit/scstreamdelegate/stream(_:didstopwitherror:)"
---

# stream(_:didStopWithError:)

Tells the delegate that the stream stopped with an error.

## Declaration

```swift
optional func stream(_ stream: SCStream, didStopWithError error: any Error)
```

## Parameters

- `stream`: The stream that stopped.
- `error`: The error that caused the stream stoppage.

## Discussion

Discussion note: When the error parameter has the code SCStreamError.Code.userStopped, the user took an intentional action to cancel the stream. Treat errors of this type as expected and recoverable failures.
