Skip to content

Commit 4248ce3

Browse files
committed
jsonrpc2: add req.Reply error handling
1 parent fb8a2c2 commit 4248ce3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

jsonrpc2.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ type Request struct {
137137

138138
var defaultHandler = func(ctx context.Context, req *Request) {
139139
if req.IsNotify() {
140-
req.Reply(ctx, req, Errorf(MethodNotFound, "method %q not found", req.Method))
140+
req.Conn().err = req.Reply(ctx, req, Errorf(MethodNotFound, "method %q not found", req.Method))
141141
}
142142
}
143143

@@ -452,7 +452,7 @@ func (c *Conn) Run(ctx context.Context) (err error) {
452452
defer func() {
453453
c.setHandling(req, false)
454454
if !req.IsNotify() && req.state < requestReplied {
455-
req.Reply(reqCtx, nil, Errorf(InternalError, "method %q did not reply", req.Method))
455+
c.err = req.Reply(reqCtx, nil, Errorf(InternalError, "method %q did not reply", req.Method))
456456
}
457457
req.Parallel()
458458
cancelReq()

0 commit comments

Comments
 (0)