adamwiggins (owner)

Forks

Revisions

gist: 49449 Download_button fork
public
Public Clone URL: git://gist.github.com/49449.git
Embed All Files: show embed
get_exceptional_from_sinatra.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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