Skip to content

Commit

Permalink
jsonrpc2: add req.Reply error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
zchee committed Jul 1, 2019
1 parent fb8a2c2 commit 4248ce3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jsonrpc2.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ type Request struct {

var defaultHandler = func(ctx context.Context, req *Request) {
if req.IsNotify() {
req.Reply(ctx, req, Errorf(MethodNotFound, "method %q not found", req.Method))
req.Conn().err = req.Reply(ctx, req, Errorf(MethodNotFound, "method %q not found", req.Method))
}
}

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

0 comments on commit 4248ce3

Please sign in to comment.