Skip to content

Commit

Permalink
Ensure returning error from failed serialize of params
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Broadhurst <[email protected]>
  • Loading branch information
peterbroadhurst committed Aug 4, 2024
1 parent 14acc4f commit 7465a4a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pkg/rpcbackend/wsbackend.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +343,14 @@ func (rc *wsRPCClient) Subscriptions() []Subscription {
}

func (rc *wsRPCClient) sendRPC(ctx context.Context, reqID string, rpcReq *RPCRequest) *RPCError {
jsonInput, _ := json.Marshal(rpcReq)
log.L(ctx).Debugf("RPC[%s] --> %s", reqID, rpcReq.Method)
if logrus.IsLevelEnabled(logrus.TraceLevel) {
log.L(ctx).Tracef("RPC[%s] INPUT: %s", reqID, jsonInput)
jsonInput, err := json.Marshal(rpcReq)
if err == nil {
log.L(ctx).Debugf("RPC[%s] --> %s", reqID, rpcReq.Method)
if logrus.IsLevelEnabled(logrus.TraceLevel) {
log.L(ctx).Tracef("RPC[%s] INPUT: %s", reqID, jsonInput)
}
err = rc.client.Send(ctx, jsonInput)
}
err := rc.client.Send(ctx, jsonInput)
if err != nil {
rpcErr := NewRPCError(ctx, RPCCodeInternalError, signermsgs.MsgRPCRequestFailed, err)
log.L(ctx).Errorf("RPC[%s] <-- ERROR: %s", reqID, err)
Expand Down

0 comments on commit 7465a4a

Please sign in to comment.