Skip to content

Commit 3f2a408

Browse files
committed
fix: prevent panic in report template when dump fails
replace panics with error messages in the dump template function, allowing test reports to render gracefully on timeouts fixes #251
1 parent d3f6a67 commit 3f2a408

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tooling/test/report.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ func report(t *testing.T, test SugarTest, req *http.Request, res *http.Response,
7474
// "http: ContentLength=6 with Body length 0"
7575
b, err = httputil.DumpResponse(v, false)
7676
default:
77-
panic("unknown type")
77+
return fmt.Sprintf("error: unknown type %T", v)
7878
}
7979

8080
if err != nil {
81-
panic(err)
81+
return fmt.Sprintf("error: failed to dump %T: %v", v, err)
8282
}
8383

8484
return string(b)

0 commit comments

Comments
 (0)