Sha256: 9cdbb07e6a9e6d350d92c47289ee28de0b3d2e70f7e4336a34c9e5f6c8c63c85

Contents?: true

Size: 814 Bytes

Versions: 17

Compression:

Stored size: 814 Bytes

Contents

# frozen_string_literal: true

module Grape
  module ErrorFormatter
    module Txt
      extend Base

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

          result = message.is_a?(Hash) ? ::Grape::Json.dump(message) : message
          rescue_options = options[:rescue_options] || {}
          if rescue_options[:backtrace] && backtrace && !backtrace.empty?
            result += "\r\n backtrace:"
            result += backtrace.join("\r\n ")
          end
          if rescue_options[:original_exception] && original_exception
            result += "\r\n original exception:"
            result += "\r\n #{original_exception.inspect}"
          end
          result
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
grape-2.0.0 lib/grape/error_formatter/txt.rb
grape-1.8.0 lib/grape/error_formatter/txt.rb
grape-1.7.1 lib/grape/error_formatter/txt.rb
grape-1.7.0 lib/grape/error_formatter/txt.rb
grape-1.6.2 lib/grape/error_formatter/txt.rb
grape-1.6.1 lib/grape/error_formatter/txt.rb
grape-1.6.0 lib/grape/error_formatter/txt.rb
grape-1.5.3 lib/grape/error_formatter/txt.rb
grape-1.5.2 lib/grape/error_formatter/txt.rb
grape-1.5.1 lib/grape/error_formatter/txt.rb
grape-1.5.0 lib/grape/error_formatter/txt.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/grape-1.4.0/lib/grape/error_formatter/txt.rb
grape-1.4.0 lib/grape/error_formatter/txt.rb
grape-1.3.3 lib/grape/error_formatter/txt.rb
grape-1.3.2 lib/grape/error_formatter/txt.rb
grape-1.3.1 lib/grape/error_formatter/txt.rb
grape-1.3.0 lib/grape/error_formatter/txt.rb