Sha256: f3eaf41937efcdca7838caa53f7445d96c9ca08ab5a50b6d0f57f76c54514d4b

Contents?: true

Size: 440 Bytes

Versions: 3

Compression:

Stored size: 440 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

3 entries across 3 versions & 2 rubygems

Version Path
grape-security-0.8.0 lib/grape/error_formatter/json.rb
grape-0.8.0 lib/grape/error_formatter/json.rb
grape-0.7.0 lib/grape/error_formatter/json.rb