aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r--actionpack/lib/action_dispatch/middleware/debug_exceptions.rb15
1 files changed, 9 insertions, 6 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb b/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb
index d93b5fd659..e5500ccdac 100644
--- a/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb
+++ b/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb
@@ -93,24 +93,27 @@ module ActionDispatch
def render_for_api_application(request, wrapper)
body = {
- status: wrapper.status_code,
- error: Rack::Utils::HTTP_STATUS_CODES.fetch(wrapper.status_code, Rack::Utils::HTTP_STATUS_CODES[500]),
+ status: wrapper.status_code,
+ error: Rack::Utils::HTTP_STATUS_CODES.fetch(
+ wrapper.status_code,
+ Rack::Utils::HTTP_STATUS_CODES[500]
+ ),
exception: wrapper.exception.inspect,
- traces: wrapper.traces
+ traces: wrapper.traces
}
content_type = request.formats.first
to_format = "to_#{content_type.to_sym}"
if content_type && body.respond_to?(to_format)
- body = body.public_send(to_format)
+ formatted_body = body.public_send(to_format)
format = content_type
else
- body = body.to_json
+ formatted_body = body.to_json
format = Mime::JSON
end
- render(wrapper.status_code, body, format)
+ render(wrapper.status_code, formatted_body, format)
end
def create_template(request, wrapper)