Skip to content

Commit

Permalink
Don't log any error details.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Jan 13, 2023
1 parent 41ae54d commit c3812e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/rack/error_handler.rb
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions test/spec_error_handler.rb
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

0 comments on commit c3812e3

Please sign in to comment.