Skip to content

Commit 326d886

Browse files
ghiculescujeremy
authored andcommitted
Avoid returning a constant in ActionDispatch::ShowExceptions
1 parent 6e9304a commit 326d886

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

actionpack/lib/action_dispatch/middleware/show_exceptions.rb

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,8 @@ module ActionDispatch
1414
# If the application returns a "X-Cascade" pass response, this middleware
1515
# will send an empty response as result with the correct status code.
1616
# If any exception happens inside the exceptions app, this middleware
17-
# catches the exceptions and returns a FAILSAFE_RESPONSE.
17+
# catches the exceptions and returns a failsafe response.
1818
class ShowExceptions
19-
FAILSAFE_RESPONSE = [500, { "Content-Type" => "text/plain" },
20-
["500 Internal Server Error\n" \
21-
"If you are the administrator of this website, then please read this web " \
22-
"application's log file and/or the web server's log file to find out what " \
23-
"went wrong."]]
24-
2519
def initialize(app, exceptions_app)
2620
@app = app
2721
@exceptions_app = exceptions_app
@@ -52,7 +46,12 @@ def render_exception(request, exception)
5246
response[1]["X-Cascade"] == "pass" ? pass_response(status) : response
5347
rescue Exception => failsafe_error
5448
$stderr.puts "Error during failsafe response: #{failsafe_error}\n #{failsafe_error.backtrace * "\n "}"
55-
FAILSAFE_RESPONSE
49+
50+
[500, { "Content-Type" => "text/plain" },
51+
["500 Internal Server Error\n" \
52+
"If you are the administrator of this website, then please read this web " \
53+
"application's log file and/or the web server's log file to find out what " \
54+
"went wrong."]]
5655
end
5756

5857
def pass_response(status)

0 commit comments

Comments
 (0)