Commit 39d53cbb authored by Kirill Smelkov's avatar Kirill Smelkov

wcfs: Clarify error context when WatchLink.sendReq is waiting for reply

sendReq has two phases: a) send request, and b) read reply. When there
is an error on the first phase, e.g. client does not read what wcfs is
trying to send, it returns an error like

    pin #2 @03fb63abd6d65b33: sendReq: send .2: context deadline exceeded

however when there is an error on the second phase, e.g. client does not
reply to wcfs request, it currently returns an error like

    pin #2 @03fb63abd6d65b33: sendReq: context deadline exceeded

which is not clear to interpret about which part was problematic.

After this patch the error for the second case becomes

    pin #2 @03fb63abd6d65b33: sendReq: waiting for reply: context deadline exceeded

which is easier to interpret.

/reviewed-by @levin.zimmermann
/reviewed-on !31
parent 764d4da8
...@@ -2285,6 +2285,7 @@ func (wlink *WatchLink) sendReq(ctx context.Context, req string) (reply string, ...@@ -2285,6 +2285,7 @@ func (wlink *WatchLink) sendReq(ctx context.Context, req string) (reply string,
return "", err return "", err
} }
defer xerr.Contextf(&err, "waiting for reply")
select { select {
case <-ctx.Done(): case <-ctx.Done():
return "", ctx.Err() return "", ctx.Err()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment