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

Method HandlerReturnError

context_wrapper.go:162–173  ·  view source on GitHub ↗

HandlerReturnError same as `Handler` but it converts a handler which returns an error.

(handler func(T) error)

Source from the content-addressed store, hash-verified

160
161// HandlerReturnError same as `Handler` but it converts a handler which returns an error.
162func (w *ContextWrapper[T]) HandlerReturnError(handler func(T) error) func(Context) error {
163 if handler == nil {
164 return nil
165 }
166
167 return func(ctx Context) error {
168 newT := w.pool.Acquire(ctx)
169 err := handler(newT)
170 w.pool.Release(newT)
171 return err
172 }
173}
174
175// HandlerReturnDuration same as `Handler` but it converts a handler which returns a time.Duration.
176func (w *ContextWrapper[T]) HandlerReturnDuration(handler func(T) time.Duration) func(Context) time.Duration {

Callers

nothing calls this directly

Calls 3

AcquireMethod · 0.65
ReleaseMethod · 0.65
handlerFunction · 0.50

Tested by

no test coverage detected