tsweb: when unwrapping HTTPError, record the user-facing message also in the log

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>
This commit is contained in:
David Crawshaw
2020-09-17 09:56:12 -04:00
committed by David Crawshaw
parent dea3ef0597
commit 815bf017fc
3 changed files with 12 additions and 3 deletions

View File

@ -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",