From 3032ec42ca30c71c952cb2216d07335e4ea1791c Mon Sep 17 00:00:00 2001 From: Louis Thibault Date: Fri, 22 Jul 2022 20:26:32 +0200 Subject: [PATCH 1/2] Guard call to fmt.Errorf with nil-error check. --- rpc/answer.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rpc/answer.go b/rpc/answer.go index c03d12cf..37303248 100644 --- a/rpc/answer.go +++ b/rpc/answer.go @@ -123,7 +123,9 @@ func (c *Conn) newReturn(ctx context.Context) (rpccp.Return, func(), capnp.Relea send: send, release: release, callback: func(err error) { - c.er.ReportError(fmt.Errorf("send return: %w", err)) + if err != nil { + c.er.ReportError(fmt.Errorf("send return: %w", err)) + } }, }) }, release, nil From 08d83ac3d3f2371103b4519f4e6ca824e1b0db9d Mon Sep 17 00:00:00 2001 From: Louis Thibault Date: Fri, 22 Jul 2022 20:27:00 +0200 Subject: [PATCH 2/2] Fix error due to nil *Exception being cast as error. --- rpc/answer.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rpc/answer.go b/rpc/answer.go index 37303248..8b78b356 100644 --- a/rpc/answer.go +++ b/rpc/answer.go @@ -234,7 +234,9 @@ func (ans *answer) sendReturn() (releaseList, error) { var err error ans.exportRefs, err = ans.c.fillPayloadCapTable(ans.results, ans.resultCapTable) - ans.c.er.ReportError(rpcerr.Annotate(err, "send return")) // nop if err == nil + if err != nil { + ans.c.er.ReportError(rpcerr.Annotate(err, "send return")) + } // Continue. Don't fail to send return if cap table isn't fully filled. select {