MCPcopy Create free account
hub / github.com/goadesign/goa / parseResponseArgs

Function parseResponseArgs

dsl/response.go:259–286  ·  view source on GitHub ↗
(val any, args ...any)

Source from the content-addressed store, hash-verified

257}
258
259func parseResponseArgs(val any, args ...any) (code int, fn func()) {
260 switch t := val.(type) {
261 case int:
262 code = t
263 if len(args) > 1 {
264 eval.TooManyArgError()
265 return
266 }
267 if len(args) == 1 {
268 if d, ok := args[0].(func()); ok {
269 fn = d
270 } else {
271 eval.InvalidArgError("function", args[0])
272 return
273 }
274 }
275 case func():
276 if len(args) > 0 {
277 eval.TooManyArgError()
278 return
279 }
280 fn = t
281 default:
282 eval.InvalidArgError("int (HTTP status code) or function", val)
283 return
284 }
285 return
286}
287
288func httpOrJSONRPCError(n string, p eval.Expression, args ...any) *expr.HTTPErrorExpr {
289 if len(args) == 0 {

Callers 3

ResponseFunction · 0.85
grpcErrorFunction · 0.85
httpOrJSONRPCErrorFunction · 0.85

Calls 2

TooManyArgErrorFunction · 0.92
InvalidArgErrorFunction · 0.92

Tested by

no test coverage detected