Forked from adamwiggins/get_exceptional_from_sinatra.rb
Created
May 28, 2010 14:56
-
-
Save adhusson/417251 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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