do not dump 404 traces
This commit is contained in:
parent
d8fc41c822
commit
fd74972da1
|
@ -787,9 +787,9 @@ module Sinatra
|
|||
# Error handling during requests.
|
||||
def handle_exception!(boom)
|
||||
@env['sinatra.error'] = boom
|
||||
dump_errors!(boom) if settings.dump_errors?
|
||||
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
|
||||
@response.status = boom.respond_to?(:code) ? Integer(boom.code) : 500
|
||||
|
||||
if not_found?
|
||||
headers['X-Cascade'] = 'pass'
|
||||
|
|
|
@ -306,6 +306,29 @@ class SettingsTest < Test::Unit::TestCase
|
|||
get '/'
|
||||
assert body.include?("RuntimeError") && body.include?("settings_test.rb")
|
||||
end
|
||||
|
||||
it 'does not dump 404 errors' do
|
||||
klass = Sinatra.new(Sinatra::Application)
|
||||
|
||||
mock_app(klass) {
|
||||
enable :dump_errors
|
||||
disable :raise_errors
|
||||
|
||||
error do
|
||||
error = @env['rack.errors'].instance_variable_get(:@error)
|
||||
error.rewind
|
||||
|
||||
error.read
|
||||
end
|
||||
|
||||
get '/' do
|
||||
raise Sinatra::NotFound
|
||||
end
|
||||
}
|
||||
|
||||
get '/'
|
||||
assert !body.include?("NotFound") && !body.include?("settings_test.rb")
|
||||
end
|
||||
end
|
||||
|
||||
describe 'sessions' do
|
||||
|
|
Loading…
Reference in New Issue