Skip to content
This repository has been archived by the owner on Apr 11, 2020. It is now read-only.

vicanso/elton-recover

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

elton-recover

The middleware has been archived, please use the middleware of elton.

Build Status

Recover middleware for elton, it can get panic error to avoid application crash.

package main

import (
	"errors"

	"github.com/vicanso/elton"

	recover "github.com/vicanso/elton-recover"
)

func main() {
	e := elton.New()

	e.Use(recover.New())

	e.GET("/", func(c *elton.Context) (err error) {
		panic(errors.New("abcd"))
	})

	err := e.ListenAndServe(":3000")
	if err != nil {
		panic(err)
	}
}