Sha256: 98117368f9e16e26fb87f952a8f11a3c6897b85563970756cc76539cd6f92ff3

Contents?: true

Size: 764 Bytes

Versions: 12

Compression:

Stored size: 764 Bytes

Contents

# frozen_string_literal: true

module Grape
  module ErrorFormatter
    module Xml
      extend Base

      class << self
        def call(message, backtrace, options = {}, env = nil, original_exception = nil)
          message = present(message, env)

          result = message.is_a?(Hash) ? message : { message: message }
          rescue_options = options[:rescue_options] || {}
          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
          result.respond_to?(:to_xml) ? result.to_xml(root: :error) : result.to_s
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
grape-2.2.0 lib/grape/error_formatter/xml.rb
grape-2.1.3 lib/grape/error_formatter/xml.rb
grape-2.1.2 lib/grape/error_formatter/xml.rb
grape-2.1.1 lib/grape/error_formatter/xml.rb
grape-2.1.0 lib/grape/error_formatter/xml.rb
grape-2.0.0 lib/grape/error_formatter/xml.rb
grape-1.8.0 lib/grape/error_formatter/xml.rb
grape-1.7.1 lib/grape/error_formatter/xml.rb
grape-1.7.0 lib/grape/error_formatter/xml.rb
grape-1.6.2 lib/grape/error_formatter/xml.rb
grape-1.6.1 lib/grape/error_formatter/xml.rb
grape-1.6.0 lib/grape/error_formatter/xml.rb