errors.go
func (a *App) PanicHandler(next Handler) Handler {
	return func(c Context) error {
		defer func() { //catch or finally
			r := recover()
			var err error
			if r != nil { //catch
				switch t := r.(type) {
				case error:
					err = t
				case string:
					err = errors.New(t)
				default:
					err = errors.New(fmt.Sprint(t))
				}
				err = err
				events.EmitError(events.ErrPanic, err,
					map[string]interface{}{
						"context": c,
						"app":     a,
					},
				)
				eh := a.ErrorHandlers.Get(500)
				eh(500, err, c)
			}
		}()
		return next(c)
	}
}
func (a *App) PanicHandler(next Handler) Handler {
	return func(c Context) error {
		defer func() { //catch or finally
			r := recover()
			var err error
			if r != nil { //catch
				switch t := r.(type) {
				case error:
					err = t
				case string:
					err = errors.New(t)
				default:
					err = errors.New(fmt.Sprint(t))
				}
				err = err
				events.EmitError(events.ErrPanic, err,
					map[string]interface{}{
						"context": c,
						"app":     a,
					},
				)
				eh := a.ErrorHandlers.Get(500)
				eh(500, err, c)
			}
		}()
		return next(c)
	}
}
// PanicHandler recovers from panics gracefully and calls
// the error handling code for a 500 error.