Skip to content

Commit

Permalink
handle error
Browse files Browse the repository at this point in the history
  • Loading branch information
philandstuff committed Oct 10, 2024
1 parent 1995b8c commit f1ffce9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,11 @@ func (r *Client) streamTextTo(ctx context.Context, writer *io.PipeWriter, url st
lastEventID = event.Id()
switch event.Event() {
case SSETypeOutput:
io.WriteString(writer, event.Data())
_, err := io.WriteString(writer, event.Data())
if err != nil {
writer.CloseWithError(err)
return
}
case SSETypeDone:
writer.Close()
return
Expand Down

0 comments on commit f1ffce9

Please sign in to comment.