Skip to content

Commit 59105aa

Browse files
committed
Propage sink error in case it exists and input error is context canceled (generic and consquential)
1 parent 7b87f63 commit 59105aa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/media/pipeline.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ func (p *Pipeline) Run(ctx context.Context) error {
203203
// Return the error from the most upstream part of the pipeline
204204
err = p.input.Close()
205205
sinkErr := p.sink.Close()
206-
if err == nil {
206+
207+
if err == nil || (err == context.Canceled && sinkErr != nil) {
208+
// prefer sink error if exists (causal and more specific) over the generic context.Canceled error
207209
err = sinkErr
208210
}
209211

0 commit comments

Comments
 (0)