JSON Recovery middleware for negroni

[Martini]( is a framework for quickly writing modular web
applications/services in Go.

This recovery middleware catches any panics and wraps them up into a json response, including
the line number where the panic occured. Borrows heavily from the default
[recovery middleware in martini](

See also

NOTE: this middleware relies on martini.Env being set. In production mode, it will render a
generic error message and exclude the line number for security reasons.


### Installation

Installation is the same as any other package
go get

Make sure you have imported the package:

import ""

Then add to the middleware stack:


### Full Example

package main

import (

func main() {
	m := martini.Classic()
	m.Get("/", func() string {
		panic("Oh no! Something went wrong")

The above code will render the following response:

    "Code": 500,
    "Short": "internalError",
    "Errors": [
        "Oh no! Something went wrong"
    "From": "/Users/alex/programming/go/src/"

You can also inspect console for a more detailed message and full stack trace.

Imports 2 package(s) ΒΆ