mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-14 23:17:29 +00:00
tsweb: adjust names and docs of the "handler with errors" functions.
Signed-off-by: David Anderson <dave@natulte.net>
This commit is contained in:

committed by
Dave Anderson

parent
131541c06d
commit
df4636567f
18
tsweb/log.go
18
tsweb/log.go
@@ -6,7 +6,6 @@ package tsweb
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -42,20 +41,3 @@ func (m Msg) String() string {
|
||||
json.NewEncoder(&buf).Encode(m)
|
||||
return strings.TrimRight(buf.String(), "\n")
|
||||
}
|
||||
|
||||
// HTTPError is an error with embedded HTTP response information. When
|
||||
// received by an ErrHandler, the Code and Msg are sent to the client,
|
||||
// while Err is logged on the server.
|
||||
type HTTPError struct {
|
||||
Code int
|
||||
Msg string // sent to the end-user
|
||||
Err error
|
||||
}
|
||||
|
||||
// Error implements the error interface.
|
||||
func (e HTTPError) Error() string { return fmt.Sprintf("httperror{%d, %q, %v}", e.Code, e.Msg, 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}
|
||||
}
|
||||
|
Reference in New Issue
Block a user