Sha256: 66075655728fe2b65b8de9de772d257de6270008612d6046547df68c66c2b44c

Contents?: true

Size: 875 Bytes

Versions: 13

Compression:

Stored size: 875 Bytes

Contents

# encoding: utf-8

module Nimbu
  module Error
    class NimbuError < StandardError
      extend ::Nimbu::Utils::Descendants

      attr_reader :response_message, :response_headers

      # Initialize a new Nimbu error object.
      #
      def initialize(message=$!)
        if message.respond_to?(:backtrace)
          super(message.message)
          @response_message = message
        else
          super(message.to_s)
        end
      end

      def backtrace
        @response_message ? @response_message.backtrace : super
      end

    end # NimbuError
  end # Error
end # Nimbu

%w( service_error bad_request bad_gateway unauthorized forbidden not_found not_acceptable unprocessable_entity internal_server_error service_unavailable client_error invalid_options required_params unknown_value validations ).each do |error|
  require "nimbu-api/errors/#{error}"
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
nimbu-api-0.4.0 lib/nimbu-api/errors.rb
nimbu-api-0.3.0 lib/nimbu-api/errors.rb
nimbu-api-0.2.1 lib/nimbu-api/errors.rb
nimbu-api-0.2 lib/nimbu-api/errors.rb
nimbu-api-0.2.beta.3 lib/nimbu-api/errors.rb
nimbu-api-0.2.beta.2 lib/nimbu-api/errors.rb
nimbu-api-0.2.beta.1 lib/nimbu-api/errors.rb
nimbu-api-0.2.beta lib/nimbu-api/errors.rb
nimbu-api-0.1.5 lib/nimbu-api/errors.rb
nimbu-api-0.1.4 lib/nimbu-api/errors.rb
nimbu-api-0.1.3 lib/nimbu-api/errors.rb
nimbu-api-0.1.1 lib/nimbu-api/errors.rb
nimbu-api-0.1 lib/nimbu-api/errors.rb