MCPcopy
hub / github.com/expr-lang/expr / ErrorContains

Function ErrorContains

internal/testify/require/require.go:326–334  ·  view source on GitHub ↗

ErrorContains asserts that a function returned an error (i.e. not `nil`) and that the error contains the specified substring. actualObj, err := SomeFunction() assert.ErrorContains(t, err, expectedErrorSubString)

(t TestingT, theError error, contains string, msgAndArgs ...interface{})

Source from the content-addressed store, hash-verified

324// actualObj, err := SomeFunction()
325// assert.ErrorContains(t, err, expectedErrorSubString)
326func ErrorContains(t TestingT, theError error, contains string, msgAndArgs ...interface{}) {
327 if h, ok := t.(tHelper); ok {
328 h.Helper()
329 }
330 if assert.ErrorContains(t, theError, contains, msgAndArgs...) {
331 return
332 }
333 t.FailNow()
334}
335
336// ErrorContainsf asserts that a function returned an error (i.e. not `nil`)
337// and that the error contains the specified substring.

Callers 2

ErrorContainsMethod · 0.70
TestErrorContainsFunction · 0.70

Calls 3

ErrorContainsFunction · 0.92
FailNowMethod · 0.65
HelperMethod · 0.45

Tested by 1

TestErrorContainsFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…