diff options
author | Jorge Bejar <jorge@wyeworks.com> | 2015-07-07 13:41:04 -0300 |
---|---|---|
committer | Jorge Bejar <jorge@wyeworks.com> | 2015-12-09 10:53:45 -0300 |
commit | d879c0ec5a7eebf9eed01c84c8f95566be2aedf4 (patch) | |
tree | f9a921a7ad4d95dce19d7dc588c5502d18779128 | |
parent | b75f5c278ad2bc51faf1ae8438afad0e794a5261 (diff) | |
download | rails-d879c0ec5a7eebf9eed01c84c8f95566be2aedf4.tar.gz rails-d879c0ec5a7eebf9eed01c84c8f95566be2aedf4.tar.bz2 rails-d879c0ec5a7eebf9eed01c84c8f95566be2aedf4.zip |
Minor cleanup in AD::DebugExceptions
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/debug_exceptions.rb | 15 |
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) |