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.2.1 lib/napa/grape_extensions/error_formatter.rb
napa-0.2.0 lib/napa/grape_extensions/error_formatter.rb
napa-0.1.29 lib/napa/grape_extensions/error_formatter.rb
napa-0.1.28 lib/napa/grape_extensions/error_formatter.rb
napa-0.1.26 lib/napa/grape_extensions/error_formatter.rb
napa-0.1.25 lib/napa/grape_extensions/error_formatter.rb
napa-0.1.24 lib/napa/grape_extensions/error_formatter.rb
napa-0.1.23 lib/napa/grape_extensions/error_formatter.rb
napa-0.1.22 lib/napa/grape_extensions/error_formatter.rb
napa-0.1.21 lib/napa/grape_extensions/error_formatter.rb
napa-0.1.20 lib/napa/grape_extensions/error_formatter.rb
napa-0.1.19 lib/napa/grape_extensions/error_formatter.rb
napa-0.1.18 lib/napa/grape_extensions/error_formatter.rb
napa-0.1.17 lib/napa/grape_extensions/error_formatter.rb
napa-0.1.16 lib/napa/grape_extensions/error_formatter.rb
napa-0.1.15 lib/napa/grape_extensions/error_formatter.rb
napa-0.1.14 lib/napa/grape_extensions/error_formatter.rb
napa-0.1.12 lib/napa/grape_extensions/error_formatter.rb
napa-0.1.13 lib/napa/grape_extensions/error_formatter.rb
napa-0.1.11 lib/napa/grape_extensions/error_formatter.rb