do not raise NotFound exceptions, even if show_exceptions is enabled, fixes #324

This commit is contained in:
Konstantin Haase 2011-07-24 13:20:28 +02:00
parent 89189a1dd8
commit 9d29e6ff60
2 changed files with 6 additions and 8 deletions

View File

@ -801,8 +801,11 @@ module Sinatra
def handle_exception!(boom)
@env['sinatra.error'] = boom
status boom.respond_to?(:code) ? Integer(boom.code) : 500
dump_errors! boom if settings.dump_errors? and server_error?
raise boom if settings.show_exceptions? and settings.show_exceptions != :after_handler
if server_error?
dump_errors! boom if settings.dump_errors?
raise boom if settings.show_exceptions? and settings.show_exceptions != :after_handler
end
if not_found?
headers['X-Cascade'] = 'pass'

View File

@ -112,12 +112,7 @@ class MappedErrorTest < Test::Unit::TestCase
end
it "never raises Sinatra::NotFound beyond the application" do
mock_app {
set :raise_errors, true
get '/' do
raise Sinatra::NotFound
end
}
mock_app(Sinatra::Application) { get('/') { raise Sinatra::NotFound }}
assert_nothing_raised { get '/' }
assert_equal 404, status
end