Sha256: fcdcfde8981a23c512d30251e07159d5b2fd22e9b9e23738fb07017a50fc3daf

Contents?: true

Size: 513 Bytes

Versions: 3

Compression:

Stored size: 513 Bytes

Contents

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

          result = message.is_a?(String) ? { error: message } : message
          if (options[:rescue_options] || {})[:backtrace] && backtrace && !backtrace.empty?
            result = result.merge(backtrace: backtrace)
          end
          MultiJson.dump(result)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
grape-0.14.0 lib/grape/error_formatter/json.rb
grape-0.13.0 lib/grape/error_formatter/json.rb
grape-0.12.0 lib/grape/error_formatter/json.rb