Sha256: 435cb3ae24cffb6cd18e5cc856befc8b4c3884209df03715b921fc8e59156a62

Contents?: true

Size: 453 Bytes

Versions: 11

Compression:

Stored size: 453 Bytes

Contents

module Grape
  module ErrorFormatter
    module Json
      class << self

        def call(message, backtrace, options = {}, env = nil)
          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

11 entries across 11 versions & 1 rubygems

Version Path
grape-0.6.0 lib/grape/error_formatter/json.rb
grape-0.5.0 lib/grape/error_formatter/json.rb
grape-0.4.1 lib/grape/error_formatter/json.rb
grape-0.4.0 lib/grape/error_formatter/json.rb
grape-0.3.2 lib/grape/error_formatter/json.rb
grape-0.3.1 lib/grape/error_formatter/json.rb
grape-0.3.0 lib/grape/error_formatter/json.rb
grape-0.2.6 lib/grape/error_formatter/json.rb
grape-0.2.5 lib/grape/error_formatter/json.rb
grape-0.2.4 lib/grape/error_formatter/json.rb
grape-0.2.3 lib/grape/error_formatter/json.rb