MCPcopy
hub / github.com/grafana/k6 / testErrorCode

Function testErrorCode

lib/netext/httpext/error_codes_test.go:107–117  ·  view source on GitHub ↗
(t *testing.T, code errCode, err error)

Source from the content-addressed store, hash-verified

105}
106
107func testErrorCode(t *testing.T, code errCode, err error) {
108 t.Helper()
109 result, _ := errorCodeForError(err)
110 require.Equalf(t, code, result, "Wrong error code for error `%s`", err)
111
112 result, _ = errorCodeForError(fmt.Errorf("foo: %w", err))
113 require.Equalf(t, code, result, "Wrong error code for error `%s`", err)
114
115 result, _ = errorCodeForError(&url.Error{Err: err})
116 require.Equalf(t, code, result, "Wrong error code for error `%s`", err)
117}
118
119func testMapOfErrorCodes(t *testing.T, testTable map[errCode]error) {
120 t.Helper()

Callers 3

TestDefaultErrorFunction · 0.85
TestBlackListedIPErrorFunction · 0.85
testMapOfErrorCodesFunction · 0.85

Calls 2

errorCodeForErrorFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…