do not raise NotFound exceptions, even if show_exceptions is enabled, fixes #324
This commit is contained in:
parent
89189a1dd8
commit
9d29e6ff60
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue