FallbackViewFunc same as `Handler` but it converts a handler to FallbackViewFunc.
(handler func(ctx T, err ErrViewNotExist) error)
| 202 | |
| 203 | // FallbackViewFunc same as `Handler` but it converts a handler to FallbackViewFunc. |
| 204 | func (w *ContextWrapper[T]) FallbackViewFunc(handler func(ctx T, err ErrViewNotExist) error) FallbackViewFunc { |
| 205 | if handler == nil { |
| 206 | return nil |
| 207 | } |
| 208 | |
| 209 | return func(ctx Context, err ErrViewNotExist) error { |
| 210 | newT := w.pool.Acquire(ctx) |
| 211 | returningErr := handler(newT, err) |
| 212 | w.pool.Release(newT) |
| 213 | return returningErr |
| 214 | } |
| 215 | } |