tsweb: allow HTTPError to unwrap errors

Signed-off-by: Will Norris <will@tailscale.com>
This commit is contained in:
Will Norris
2022-10-04 20:39:10 -07:00
committed by Will Norris
parent 2243dbccb7
commit 62bc1052a2
2 changed files with 10 additions and 0 deletions
+2
View File
@@ -421,6 +421,8 @@ type HTTPError struct {
// Error implements the error interface.
func (e HTTPError) Error() string { return fmt.Sprintf("httperror{%d, %q, %v}", e.Code, e.Msg, e.Err) }
func (e HTTPError) Unwrap() error { return e.Err }
// Error returns an HTTPError containing the given information.
func Error(code int, msg string, err error) HTTPError {
return HTTPError{Code: code, Msg: msg, Err: err}