HandlerReturnError same as `Handler` but it converts a handler which returns an error.
(handler func(T) error)
| 160 | |
| 161 | // HandlerReturnError same as `Handler` but it converts a handler which returns an error. |
| 162 | func (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. |
| 176 | func (w *ContextWrapper[T]) HandlerReturnDuration(handler func(T) time.Duration) func(Context) time.Duration { |