Skip to content

Commit

Permalink
Fix unwrapping of gRPC OK status. (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
dennwc authored Feb 5, 2025
1 parent 6de8b05 commit a0beed2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/server/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"sync"
"time"

"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"

Expand Down Expand Up @@ -264,7 +265,7 @@ func (h *rpcHandlerImpl[RequestType, ResponseType]) sendResponse(
res.Error = e.Error()
res.Code = string(e.Code())
res.ErrorDetails = append(res.ErrorDetails, e.DetailsProto()...)
} else if st, ok := status.FromError(err); ok {
} else if st, ok := status.FromError(err); ok && st != nil && st.Code() != codes.OK {
res.Error = st.Message()
res.Code = string(psrpc.ErrorCodeFromGRPC(st.Code()))
res.ErrorDetails = append(res.ErrorDetails, st.Proto().Details...)
Expand Down

0 comments on commit a0beed2

Please sign in to comment.