Sha256: d0a4f1889bedef38fcd98c9a34c345b320911b51a60e149c3d34f049c2a8967c

Contents?: true

Size: 561 Bytes

Versions: 7

Compression:

Stored size: 561 Bytes

Contents

module Grape
  module ErrorFormatter
    module Xml
      class << self
        def call(message, backtrace, options = {}, env = nil)
          message = Grape::ErrorFormatter::Base.present(message, env)

          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
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
grape-0.14.0 lib/grape/error_formatter/xml.rb
grape-0.13.0 lib/grape/error_formatter/xml.rb
grape-0.12.0 lib/grape/error_formatter/xml.rb
grape-0.11.0 lib/grape/error_formatter/xml.rb
grape-0.10.1 lib/grape/error_formatter/xml.rb
grape-0.10.0 lib/grape/error_formatter/xml.rb
grape-0.9.0 lib/grape/error_formatter/xml.rb