Sha256: 1d17193e75008d6f2decd934707dcfd5efc7502248f0aa130c4e65c87f710ed7

Contents?: true

Size: 511 Bytes

Versions: 4

Compression:

Stored size: 511 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?(Hash) ? message : { error: 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

4 entries across 4 versions & 1 rubygems

Version Path
grape-0.11.0 lib/grape/error_formatter/json.rb
grape-0.10.1 lib/grape/error_formatter/json.rb
grape-0.10.0 lib/grape/error_formatter/json.rb
grape-0.9.0 lib/grape/error_formatter/json.rb