Skip to content

Commit

Permalink
Logging exceptions to env['rack.errors']
Browse files Browse the repository at this point in the history
  • Loading branch information
bmizerany committed Nov 12, 2008
1 parent 7034623 commit 7b20242
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/sinatra.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,10 @@ def dispatch(env)
end
body = returned.to_result(context)
rescue => e
msg = "#{e.class.name} - #{e.message}:"
msg << "\n #{e.backtrace.join("\n ")}"
request.env['rack.errors'] << msg

request.env['sinatra.error'] = e
context.status(500)
raise if options.raise_errors && e.class != NotFound
Expand Down

0 comments on commit 7b20242

Please sign in to comment.