From c3812e3865d11200f54e11389e108dbc458a4f29 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Sat, 14 Jan 2023 10:41:22 +1300 Subject: [PATCH] Don't log any error details. --- lib/rack/error_handler.rb | 4 ++-- test/spec_error_handler.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/rack/error_handler.rb b/lib/rack/error_handler.rb index 1426ff726..f949d4f93 100644 --- a/lib/rack/error_handler.rb +++ b/lib/rack/error_handler.rb @@ -19,11 +19,11 @@ def log_error(env, error) end def bad_request(error) - [400, {}, ["Bad Request: #{error.class}"]] + [400, {}, ["Bad Request"]] end def internal_server_error(error) - [500, {}, ["Internal Server Error: #{error.class}"]] + [500, {}, ["Internal Server Error"]] end def call(env) diff --git a/test/spec_error_handler.rb b/test/spec_error_handler.rb index 8d3b5659c..5df50f2d2 100644 --- a/test/spec_error_handler.rb +++ b/test/spec_error_handler.rb @@ -23,7 +23,7 @@ response = middleware.call(Rack::MockRequest.env_for("/")) response[0].must_equal 400 - response[2].to_ary.must_equal ["Bad Request: #{error}"] + response[2].to_ary.must_equal ["Bad Request"] end it "catches standard errors as 500 Internal Server Error" do @@ -37,7 +37,7 @@ response = middleware.call(Rack::MockRequest.env_for("/")) response[0].must_equal 500 - response[2].to_ary.must_equal ["Internal Server Error: #{error}"] + response[2].to_ary.must_equal ["Internal Server Error"] end it "logs errors to the rack.errors stream" do @@ -52,6 +52,6 @@ errors.string.must_match(/b00m/) response[0].must_equal 500 - response[2].to_ary.must_equal ["Internal Server Error: RuntimeError"] + response[2].to_ary.must_equal ["Internal Server Error"] end end