diff options
| author | David Crawshaw <crawshaw@tailscale.com> | 2020-09-17 09:56:12 -0400 |
|---|---|---|
| committer | David Crawshaw <crawshaw@tailscale.com> | 2020-09-17 09:57:36 -0400 |
| commit | ad10cd71a626b005d14bc781e037df18be8128fe (patch) | |
| tree | 8f3f348be3bab458d3434b87a7c623b21b38be9a /tsweb/jsonhandler.go | |
| parent | dea3ef0597d39616276495bab40366cfafc22925 (diff) | |
| download | tailscale-crawshaw/jsonhandler.tar.xz tailscale-crawshaw/jsonhandler.zip | |
tsweb: when unwrapping HTTPError, record the user-facing message also in the logcrawshaw/jsonhandler
There's often some useful piece of information in there not already
repeated in the internal error.
Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
Diffstat (limited to 'tsweb/jsonhandler.go')
| -rw-r--r-- | tsweb/jsonhandler.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tsweb/jsonhandler.go b/tsweb/jsonhandler.go index 56704da7c..3199138e6 100644 --- a/tsweb/jsonhandler.go +++ b/tsweb/jsonhandler.go @@ -58,6 +58,9 @@ func (fn JSONHandlerFunc) ServeHTTPReturn(w http.ResponseWriter, r *http.Request // the client in this handler. We don't want the wrapping // ReturnHandler to do it too. err = werr.Err + if werr.Msg != "" { + err = fmt.Errorf("%s: %w", werr.Msg, err) + } } else { resp = &response{ Status: "error", |
