MCPcopy Create free account
hub / github.com/kataras/iris / GetCustomStructWithError

Function GetCustomStructWithError

hero/func_result_test.go:75–84  ·  view source on GitHub ↗
(ctx iris.Context)

Source from the content-addressed store, hash-verified

73}
74
75func GetCustomStructWithError(ctx iris.Context) (s testCustomStruct, err error) {
76 s = testCustomStruct{"Iris", 2}
77 if ctx.URLParamExists("err") {
78 err = errors.New("omit return of testCustomStruct and fire error")
79 }
80
81 // it should send the testCustomStruct as JSON if error is nil
82 // otherwise it should fire the default error(BadRequest) with the error's text.
83 return
84}
85
86type err struct {
87 Status int `json:"status_code"`

Callers

nothing calls this directly

Calls 2

URLParamExistsMethod · 0.80
NewMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…