context.go
func (ctx *Context) Recover() {
	if err := recover(); err != nil {
		if e, ok := err.(*ValidationError); ok == true {
			ctx.Fail(e)
			return
		}

		stack := make([]byte, 64<<10)
		n := runtime.Stack(stack[:], false)
		log.WithFields(log.Fields{"path": ctx.Request.URL.Path}).Errorln(string(stack[:n]))
		if !ctx.Written() {
			ctx.ResponseWriter.Header().Del("Content-Type")

			if ctx.handlersStack.PanicHandler != nil {
				ctx.Data["panic"] = err
				ctx.handlersStack.PanicHandler(ctx)
			} else {
				ctx.Fail((&ServerError{}).New(http.StatusText(http.StatusInternalServerError)))
			}
		}
	}
}
func (ctx *Context) Recover() {
	if err := recover(); err != nil {
		if e, ok := err.(*ValidationError); ok == true {
			ctx.Fail(e)
			return
		}

		stack := make([]byte, 64<<10)
		n := runtime.Stack(stack[:], false)
		log.WithFields(log.Fields{"path": ctx.Request.URL.Path}).Errorln(string(stack[:n]))
		if !ctx.Written() {
			ctx.ResponseWriter.Header().Del("Content-Type")

			if ctx.handlersStack.PanicHandler != nil {
				ctx.Data["panic"] = err
				ctx.handlersStack.PanicHandler(ctx)
			} else {
				ctx.Fail((&ServerError{}).New(http.StatusText(http.StatusInternalServerError)))
			}
		}
	}
}
// Recover recovers form panics.
// It logs the stack and uses the PanicHandler (or a classic Internal Server Error) to write the response.
//
// Usage:
//
//	defer c.Recover()