Skip to content

Commit

Permalink
Return ErrWebrpcClientDisconnected on stream ctx timeout/cancelation
Browse files Browse the repository at this point in the history
  • Loading branch information
VojtechVitek committed Apr 17, 2024
1 parent 931e7fe commit edb53fa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion _examples/golang-basics/example.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion _examples/golang-imports/api.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions client.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ func (r *streamReader) handleReadError(err error) error {
if errors.Is(err, io.ErrUnexpectedEOF) {
return ErrWebrpcStreamLost.WithCause(err)
}
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded){
return ErrWebrpcClientDisconnected.WithCause(err)
}
return ErrWebrpcBadResponse.WithCause(fmt.Errorf("reading stream: %w", err))
}

Expand Down

0 comments on commit edb53fa

Please sign in to comment.