From 5d995d9d6b66a2b87cd71e6c389c5be8ad390704 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 3 Apr 2020 10:37:26 -0700 Subject: [PATCH] tsweb: add a test case for nil child errors in tsweb.Error. Signed-off-by: David Anderson --- tsweb/tsweb_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tsweb/tsweb_test.go b/tsweb/tsweb_test.go index 4c4de4550..6fa3ac2bf 100644 --- a/tsweb/tsweb_test.go +++ b/tsweb/tsweb_test.go @@ -121,6 +121,22 @@ func TestStdHandler(t *testing.T) { }, }, + { + name: "handler returns 404 with nil child error", + h: handlerErr(0, Error(404, "not found", nil)), + r: req(bgCtx, "http://example.com/foo"), + wantCode: 404, + wantLog: AccessLogRecord{ + When: clock.Start, + Seconds: 1.0, + Proto: "HTTP/1.1", + Host: "example.com", + Method: "GET", + RequestURI: "/foo", + Code: 404, + }, + }, + { name: "handler returns generic error", h: handlerErr(0, testErr),