aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb
diff options
context:
space:
mode:
authorJorge Bejar <jorge@wyeworks.com>2015-07-07 13:41:04 -0300
committerJorge Bejar <jorge@wyeworks.com>2015-12-09 10:53:45 -0300
commitd879c0ec5a7eebf9eed01c84c8f95566be2aedf4 (patch)
treef9a921a7ad4d95dce19d7dc588c5502d18779128 /actionpack/lib/action_dispatch/middleware/debug_exceptions.rb
parentb75f5c278ad2bc51faf1ae8438afad0e794a5261 (diff)
downloadrails-d879c0ec5a7eebf9eed01c84c8f95566be2aedf4.tar.gz
rails-d879c0ec5a7eebf9eed01c84c8f95566be2aedf4.tar.bz2
rails-d879c0ec5a7eebf9eed01c84c8f95566be2aedf4.zip
Minor cleanup in AD::DebugExceptions
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware/debug_exceptions.rb')
-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)