Skip to content

Commit

Permalink
Only run error handlers if show_excetions is set to :after_handler, n…
Browse files Browse the repository at this point in the history
…ot when it is set to true.
  • Loading branch information
rkh committed Oct 12, 2010
1 parent c4b9fdc commit af2de4e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/sinatra/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,7 @@ def handle_exception!(boom)
@env['sinatra.error'] = boom

dump_errors!(boom) if settings.dump_errors?
raise boom if settings.show_exceptions? and settings.show_exceptions != :after_handler

@response.status = 500
if res = error_block!(boom.class)
Expand Down
6 changes: 3 additions & 3 deletions test/settings_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,11 @@ def foo=(value)
assert body.include?("StandardError")
assert body.include?("<code>show_exceptions</code> setting")
end
it 'does not override app-specified error handling' do

it 'does not override app-specified error handling when set to :after_handler' do
klass = Sinatra.new(Sinatra::Application)
mock_app(klass) {
enable :show_exceptions
set :show_exceptions, :after_handler

error RuntimeError do
'Big mistake !'
Expand Down

0 comments on commit af2de4e

Please sign in to comment.