Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions connectinprocess/connectinprocess_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"errors"
"fmt"
"io"
"os"
"runtime"
"strings"
"testing"
Expand Down Expand Up @@ -860,6 +861,11 @@ func TestServerErrorDropsCause(t *testing.T) {
wantMessage: "truncated",
wantDetails: 1,
},
{
name: "os_deadline_exceeded",
err: fmt.Errorf("read from backend: %w", os.ErrDeadlineExceeded),
wantCode: connect.CodeDeadlineExceeded,
},
{
name: "remote_error_with_eof_cause",
err: connect.NewError(connect.CodeNotFound, "upstream").WithCause(io.EOF).WithRemote(),
Expand Down
3 changes: 2 additions & 1 deletion connectinprocess/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"
"errors"
"io"
"os"
"slices"
"sync"

Expand Down Expand Up @@ -333,7 +334,7 @@ func asClientErr(err error) error {
switch {
case errors.Is(err, context.Canceled):
code = connect.CodeCanceled
case errors.Is(err, context.DeadlineExceeded):
case errors.Is(err, context.DeadlineExceeded), errors.Is(err, os.ErrDeadlineExceeded):
code = connect.CodeDeadlineExceeded
}
return connect.NewError(code, "").WithRemote()
Expand Down
Loading