Skip to content

Commit

Permalink
handle error with GetContextFromRequest(), response should be init
Browse files Browse the repository at this point in the history
  • Loading branch information
hakulala authored and felipejfc committed May 24, 2021
1 parent fac48bf commit 54d2ae3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cluster/nats_rpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,12 @@ func (ns *NatsRPCServer) processMessages(threadID int) {
logger.Log.Debugf("(%d) processing message %v", threadID, ns.requests[threadID].GetMsg().GetId())
ctx, err := util.GetContextFromRequest(ns.requests[threadID], ns.server.ID)
if err != nil {
ns.responses[threadID].Error = &protos.Error{
Code: e.ErrInternalCode,
Msg: err.Error(),
ns.responses[threadID] = &protos.Response{
Error: &protos.Error{
Code: e.ErrInternalCode,
Msg: err.Error(),
},
}
ns.responses[threadID].Data = nil
} else {
ns.responses[threadID], _ = ns.pitayaServer.Call(ctx, ns.requests[threadID])
}
Expand Down

0 comments on commit 54d2ae3

Please sign in to comment.