Module: Grape::ErrorFormatter::Json

Extended by:
Base
Defined in:
lib/grape/error_formatter/json.rb

Class Method Summary collapse

Methods included from Base

present

Class Method Details

.call(message, backtrace, options = {}, env = nil) ⇒ Object


7
8
9
10
11
12
13
14
# File 'lib/grape/error_formatter/json.rb', line 7

def call(message, backtrace, options = {}, env = nil)
  result = wrap_message(present(message, env))

  if (options[:rescue_options] || {})[:backtrace] && backtrace && !backtrace.empty?
    result = result.merge(backtrace: backtrace)
  end
  MultiJson.dump(result)
end