Module: Grape::ErrorFormatter::Xml

Defined in:
lib/grape/error_formatter/xml.rb

Class Method Summary collapse

Class Method Details

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



6
7
8
9
10
11
12
# File 'lib/grape/error_formatter/xml.rb', line 6

def call(message, backtrace, options = {}, env = nil)
  result = message.is_a?(Hash) ? message : { :message => message }
  if (options[:rescue_options] || {})[:backtrace] && backtrace && ! backtrace.empty?
    result = result.merge({ :backtrace => backtrace })
  end
  result.respond_to?(:to_xml) ? result.to_xml(:root => :error) : result.to_s
end