Module: Grape::ErrorFormatter::Txt

Extended by:
Base
Defined in:
lib/grape/error_formatter/txt.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
15
16
# File 'lib/grape/error_formatter/txt.rb', line 7

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

  result = message.is_a?(Hash) ? MultiJson.dump(message) : message
  if (options[:rescue_options] || {})[:backtrace] && backtrace && !backtrace.empty?
    result += "\r\n "
    result += backtrace.join("\r\n ")
  end
  result
end