MCPcopy Create free account
hub / github.com/coder/slog / Error

Function Error

sloggers/slogtest/assert/assert.go:60–67  ·  view source on GitHub ↗

Error asserts err != nil.

(t testing.TB, name string, err error)

Source from the content-addressed store, hash-verified

58
59// Error asserts err != nil.
60func Error(t testing.TB, name string, err error) {
61 slog.Helper()
62 if err == nil {
63 slogtest.Fatal(t, "expected error",
64 slog.F("name", name),
65 )
66 }
67}
68
69// ErrorContains asserts err != nil and err.Error() contains sub.
70//

Callers 2

TestErrorFunction · 0.92
ErrorContainsFunction · 0.70

Calls 2

FatalFunction · 0.92
HelperMethod · 0.45

Tested by 1

TestErrorFunction · 0.74