MCPcopy Index your code
hub / github.com/labstack/echo / TestBindingError_Error

Function TestBindingError_Error

binder_test.go:44–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

42}
43
44func TestBindingError_Error(t *testing.T) {
45 err := NewBindingError("id", []string{"1", "nope"}, "bind failed", errors.New("internal error"))
46 assert.EqualError(t, err, `code=400, message=bind failed, err=internal error, field=id`)
47
48 bErr := err.(*BindingError)
49 assert.Equal(t, 400, bErr.Code)
50 assert.Equal(t, "bind failed", bErr.Message)
51 assert.Equal(t, errors.New("internal error"), bErr.err)
52
53 assert.Equal(t, "id", bErr.Field)
54 assert.Equal(t, []string{"1", "nope"}, bErr.Values)
55}
56
57func TestBindingError_ErrorJSON(t *testing.T) {
58 err := NewBindingError("id", []string{"1", "nope"}, "bind failed", errors.New("internal error"))

Callers

nothing calls this directly

Calls 1

NewBindingErrorFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…