Middleware for martini which catches panics and wraps them into a JSON response.