lib/grape/error_formatter/json.rb in grape-1.5.3 vs lib/grape/error_formatter/json.rb in grape-1.6.0
- old
+ new
@@ -8,15 +8,11 @@
class << self
def call(message, backtrace, options = {}, env = nil, original_exception = nil)
result = wrap_message(present(message, env))
rescue_options = options[:rescue_options] || {}
- if rescue_options[:backtrace] && backtrace && !backtrace.empty?
- result = result.merge(backtrace: backtrace)
- end
- if rescue_options[:original_exception] && original_exception
- result = result.merge(original_exception: original_exception.inspect)
- end
+ result = result.merge(backtrace: backtrace) if rescue_options[:backtrace] && backtrace && !backtrace.empty?
+ result = result.merge(original_exception: original_exception.inspect) if rescue_options[:original_exception] && original_exception
::Grape::Json.dump(result)
end
private