lib/grape/middleware/formatter.rb in grape-1.0.0 vs lib/grape/middleware/formatter.rb in grape-1.0.1
- old
+ new
@@ -43,11 +43,11 @@
formatter = fetch_formatter(headers, options)
bodymap = bodies.collect { |body| formatter.call(body, env) }
Rack::Response.new(bodymap, status, headers)
end
rescue Grape::Exceptions::InvalidFormatter => e
- throw :error, status: 500, message: e.message
+ throw :error, status: 500, message: e.message, backtrace: e.backtrace, original_exception: e
end
def fetch_formatter(headers, options)
api_format = mime_types[headers[Grape::Http::Headers::CONTENT_TYPE]] || env[Grape::Env::API_FORMAT]
Grape::Formatter.formatter_for(api_format, options)
@@ -108,10 +108,10 @@
env[Grape::Env::RACK_REQUEST_FORM_INPUT] = env[Grape::Env::RACK_INPUT]
end
rescue Grape::Exceptions::Base => e
raise e
rescue StandardError => e
- throw :error, status: 400, message: e.message
+ throw :error, status: 400, message: e.message, backtrace: e.backtrace, original_exception: e
end
else
env[Grape::Env::API_REQUEST_BODY] = body
end
end