Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save adhusson/417251 to your computer and use it in GitHub Desktop.
Save adhusson/417251 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'exceptional'
require 'sinatra'
Exceptional.api_key = "...your api key..."
module Exceptional
def self.handle_sinatra(exception, uri, request, params)
e = Exceptional.parse(exception)
e.framework = "sinatra"
e.controller_name = uri
e.occurred_at = Time.now.strftime("%Y%m%d %H:%M:%S %Z")
e.environment = request.env.to_hash
e.url = uri
e.parameters = params.to_hash
Exceptional.post e
end
end
error do
Exceptional.handle_sinatra(request.env['sinatra.error'], request.env['REQUEST_URI'], request, params)
end
get '/' do
raise
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment