Skip to content

Commit

Permalink
Call wrapIfContextError from wrapIfContextDone
Browse files Browse the repository at this point in the history
  • Loading branch information
emcfarlane committed Feb 15, 2024
1 parent f925b2e commit c332407
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 4 deletions.
3 changes: 0 additions & 3 deletions envelope.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ func (w *envelopeWriter) marshal(message any) *Error {

func (w *envelopeWriter) write(env *envelope) *Error {
if _, err := w.sender.Send(env); err != nil {
err = wrapIfContextError(err)
err = wrapIfContextDone(w.ctx, err)
if connectErr, ok := asError(err); ok {
return connectErr
Expand Down Expand Up @@ -317,7 +316,6 @@ func (r *envelopeReader) Read(env *envelope) *Error {
return NewError(CodeUnknown, err)
}
err = wrapIfMaxBytesError(err, "read 5 byte message prefix")
err = wrapIfContextError(err)
err = wrapIfContextDone(r.ctx, err)
if connectErr, ok := asError(err); ok {
return connectErr
Expand Down Expand Up @@ -351,7 +349,6 @@ func (r *envelopeReader) Read(env *envelope) *Error {
)
}
err = wrapIfMaxBytesError(err, "read %d byte message", size)
err = wrapIfContextError(err)
err = wrapIfContextDone(r.ctx, err)
if connectErr, ok := asError(err); ok {
return connectErr
Expand Down
1 change: 1 addition & 0 deletions error.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ func wrapIfContextDone(ctx context.Context, err error) error {
if err == nil {
return nil
}
err = wrapIfContextError(err)
if _, ok := asError(err); ok {
return err
}
Expand Down
1 change: 0 additions & 1 deletion protocol_connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,6 @@ func (u *connectUnaryUnmarshaler) UnmarshalFunc(message any, unmarshal func([]by
bytesRead, err := data.ReadFrom(reader)
if err != nil {
err = wrapIfMaxBytesError(err, "read first %d bytes of message", bytesRead)
err = wrapIfContextError(err)
err = wrapIfContextDone(u.ctx, err)
if connectErr, ok := asError(err); ok {
return connectErr
Expand Down

0 comments on commit c332407

Please sign in to comment.