mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-05 04:11:59 +00:00
fixup! util/vizerror: add new package for visible errors
Signed-off-by: Will Norris <will@tailscale.com>
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"tailscale.com/metrics"
|
||||
"tailscale.com/tstest"
|
||||
"tailscale.com/util/vizerror"
|
||||
"tailscale.com/version"
|
||||
)
|
||||
|
||||
@@ -151,6 +152,23 @@ func TestStdHandler(t *testing.T) {
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
name: "handler returns user visible error",
|
||||
rh: handlerErr(0, vizerror.New("visible error")),
|
||||
r: req(bgCtx, "http://example.com/foo"),
|
||||
wantCode: 500,
|
||||
wantLog: AccessLogRecord{
|
||||
When: clock.Start,
|
||||
Seconds: 1.0,
|
||||
Proto: "HTTP/1.1",
|
||||
Host: "example.com",
|
||||
Method: "GET",
|
||||
RequestURI: "/foo",
|
||||
Err: "visible error",
|
||||
Code: 500,
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
name: "handler returns generic error",
|
||||
rh: handlerErr(0, testErr),
|
||||
|
||||
Reference in New Issue
Block a user