Skip to content

Commit 0a6ff30

Browse files
committed
jsonrpc2: use %v verb
1 parent ccfb24d commit 0a6ff30

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

jsonrpc2.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func (c *Conn) Notify(ctx context.Context, method string, params interface{}) er
160160
c.Logger.Debug("Notify")
161161
p, err := c.marshalInterface(params)
162162
if err != nil {
163-
return Errorf(CodeParseError, "failed to marshaling notify parameters: %w", err)
163+
return Errorf(CodeParseError, "failed to marshaling notify parameters: %v", err)
164164
}
165165

166166
req := &NotificationMessage{
@@ -170,7 +170,7 @@ func (c *Conn) Notify(ctx context.Context, method string, params interface{}) er
170170
}
171171
data, err := json.Marshal(req) // TODO(zchee): use gojay
172172
if err != nil {
173-
return Errorf(CodeParseError, "failed to marshaling notify request: %w", err)
173+
return Errorf(CodeParseError, "failed to marshaling notify request: %v", err)
174174
}
175175

176176
c.Logger.Debug(Send,
@@ -180,7 +180,7 @@ func (c *Conn) Notify(ctx context.Context, method string, params interface{}) er
180180

181181
err = c.stream.Write(ctx, data)
182182
if err != nil {
183-
return Errorf(CodeInternalError, "failed to write notify request data to steam: %w", err)
183+
return Errorf(CodeInternalError, "failed to write notify request data to steam: %v", err)
184184
}
185185

186186
return nil
@@ -228,7 +228,7 @@ func (c *Conn) Call(ctx context.Context, method string, params, result interface
228228
)
229229

230230
if err := c.stream.Write(ctx, data); err != nil {
231-
return Errorf(CodeInternalError, "failed to write call request data to steam: %w", err)
231+
return Errorf(CodeInternalError, "failed to write call request data to steam: %v", err)
232232
}
233233

234234
// wait for the response
@@ -253,7 +253,7 @@ func (c *Conn) Call(ctx context.Context, method string, params, result interface
253253

254254
if err := json.Unmarshal(*resp.Result, result); err != nil {
255255
// if err := gojay.Unsafe.Unmarshal(*resp.Result, result); err != nil {
256-
return Errorf(CodeParseError, "failed to unmarshalling result: %w", err)
256+
return Errorf(CodeParseError, "failed to unmarshalling result: %v", err)
257257
}
258258

259259
return nil
@@ -280,7 +280,7 @@ func (c *Conn) Reply(ctx context.Context, req *Request, result interface{}, err
280280
}
281281
c.handlingMu.Unlock()
282282
if !found {
283-
return Errorf(CodeInternalError, "not a call in progress: %w", req.ID)
283+
return Errorf(CodeInternalError, "not a call in progress: %v", req.ID)
284284
}
285285

286286
elapsed := time.Since(handling.start)
@@ -313,8 +313,7 @@ func (c *Conn) Reply(ctx context.Context, req *Request, result interface{}, err
313313
zap.Any("resp.Result", resp.Result),
314314
zap.Error(err),
315315
)
316-
return Errorf(CodeParseError, "failed to marshaling reply response: %w", err)
317-
// return err
316+
return Errorf(CodeParseError, "failed to marshaling reply response: %v", err)
318317
}
319318

320319
c.Logger.Debug(Send,
@@ -327,7 +326,7 @@ func (c *Conn) Reply(ctx context.Context, req *Request, result interface{}, err
327326
if err := c.stream.Write(ctx, data); err != nil {
328327
// TODO(iancottrell): if a stream write fails, we really need to shut down
329328
// the whole stream
330-
return Errorf(CodeInternalError, "failed to write response data to steam: %w", err)
329+
return Errorf(CodeInternalError, "failed to write response data to steam: %v", err)
331330
}
332331

333332
return nil

0 commit comments

Comments
 (0)