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

Function joinContextRequestFuncs

x/errors/handlers.go:174–196  ·  view source on GitHub ↗
(requestHandlerFuncs []ContextRequestFunc[T])

Source from the content-addressed store, hash-verified

172}
173
174func joinContextRequestFuncs[T any](requestHandlerFuncs []ContextRequestFunc[T]) ContextRequestFunc[T] {
175 if len(requestHandlerFuncs) == 0 || requestHandlerFuncs[0] == nil {
176 panic("at least one context request handler function is required")
177 }
178
179 if len(requestHandlerFuncs) == 1 {
180 return requestHandlerFuncs[0]
181 }
182
183 return func(ctx *context.Context, req T) error {
184 for _, handler := range requestHandlerFuncs {
185 if handler == nil {
186 continue
187 }
188
189 if err := handler(ctx, req); err != nil {
190 return err
191 }
192 }
193
194 return nil
195 }
196}
197
198// RequestHandler is an interface which can be implemented by a request payload struct
199// in order to validate the context before calling a service function.

Callers

nothing calls this directly

Calls 1

handlerFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…