Skip to content

Commit

Permalink
use the same context when handling errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Blake Mizerany committed Nov 21, 2007
1 parent a8085ec commit 5b3f081
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/sinatra.rb
Expand Up @@ -104,15 +104,14 @@ def call(env)
request.request_method.downcase.to_sym,
request.path_info
)
context = EventContext.new(request, response)
begin
context = EventContext.new(request, response)
result = context.instance_eval(&route.block)
context.body = Array(result.to_s)
context.finish
rescue => e
raise e if config[:raise_errors]
route = Sinatra.routes[500] || Error
context = EventContext.new(request, response)
context.status 500
context.body Array(context.instance_eval(&route.block))
context.finish
Expand Down

0 comments on commit 5b3f081

Please sign in to comment.