Sha256: c564a29506e9ca791a60143858b28e9f53af9d38abe9eae121c41676199ac952

Contents?: true

Size: 527 Bytes

Versions: 22

Compression:

Stored size: 527 Bytes

Contents

if defined?(Grape)
  module Grape
    module ErrorFormatter
      module Json
        class << self
          def call(message, backtrace, options = {}, env = nil)
            result = message.is_a?(Napa::JsonError) ? message : Napa::JsonError.new(:api_error, message)

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

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
napa-0.1.10 lib/napa/grape_extensions/error_formatter.rb
napa-0.1.7 lib/napa/grape_extensions/error_formatter.rb