Sha256: 61178b295f363a07570ea3b43e52c288238b9ac3b95c72497143a6ee9390e93b

Contents?: true

Size: 884 Bytes

Versions: 5

Compression:

Stored size: 884 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 conflict ).each do |error|
  require "nimbu-api/errors/#{error}"
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nimbu-api-0.5.0 lib/nimbu-api/errors.rb
nimbu-api-0.4.4 lib/nimbu-api/errors.rb
nimbu-api-0.4.3 lib/nimbu-api/errors.rb
nimbu-api-0.4.2 lib/nimbu-api/errors.rb
nimbu-api-0.4.1 lib/nimbu-api/errors.rb