recovery

package
v3.0.0-rc.2+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

README

Middleware information

This folder contains a middleware for safety recover the server from panic

How to use


package main

import (
	"github.com/kataras/iris"
	"github.com/kataras/iris/middleware/recovery"
	"os"
)

func main() {

	iris.Use(recovery.New(os.Stderr)) // optional parameter is the writer which the stack of the panic will be printed

	iris.Get("/", func(ctx *iris.Context) {
		ctx.Write("Hi, let's panic")
		panic("errorrrrrrrrrrrrrrr")
	})

	println("Server is running at :8080")
	iris.Listen(":8080")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(out ...io.Writer) iris.Handler

New restores the server on internal server errors (panics) receives an optional writer, the default is the os.Stderr if no out writer given returns the middleware as iris.Handler same as Recovery(...)

func Recovery

func Recovery(out ...io.Writer) iris.Handler

Recovery restores the server on internal server errors (panics) receives an optional writer, the default is the os.Stderr if no out writer given returns the middleware as iris.Handler same as New(...)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL