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

Function Error

internal/testify/require/require.go:287–295  ·  view source on GitHub ↗

Error asserts that a function returned an error (i.e. not `nil`). actualObj, err := SomeFunction() if assert.Error(t, err) { assert.Equal(t, expectedError, err) }

(t TestingT, err error, msgAndArgs ...interface{})

Source from the content-addressed store, hash-verified

285// assert.Equal(t, expectedError, err)
286// }
287func Error(t TestingT, err error, msgAndArgs ...interface{}) {
288 if h, ok := t.(tHelper); ok {
289 h.Helper()
290 }
291 if assert.Error(t, err, msgAndArgs...) {
292 return
293 }
294 t.FailNow()
295}
296
297// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
298// This is a wrapper for errors.As.

Callers 15

TestExpr_errorFunction · 0.92
TestAsBool_exposed_errorFunction · 0.92
TestEval_exposed_errorFunction · 0.92
TestIssue138Function · 0.92
TestEnv_keywordFunction · 0.92
TestIssue462Function · 0.92

Calls 3

ErrorFunction · 0.92
FailNowMethod · 0.65
HelperMethod · 0.45

Tested by 15

TestExpr_errorFunction · 0.74
TestAsBool_exposed_errorFunction · 0.74
TestEval_exposed_errorFunction · 0.74
TestIssue138Function · 0.74
TestEnv_keywordFunction · 0.74
TestIssue462Function · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…