Sha256: 141d36f8997ebf46c5324d36d30f9a8f80498ac356f066f732a69454a2612ed4

Contents?: true

Size: 1.12 KB

Versions: 12

Compression:

Stored size: 1.12 KB

Contents

module FullContact
  # Custom error class for rescuing from all FullContact errors
  class Error < StandardError
    attr_reader :http_headers

    def initialize(message, http_headers)
      @http_headers = Hash[http_headers]
      super message
    end
  end

  # Raised when FullContact returns the HTTP status code 400
  class BadRequest < Error;
  end

  # Raised when FullContact returns the HTTP status code 401
  class Unauthorized < Error;
  end

  # Raised when FullContact returns the HTTP status code 403
  class Forbidden < Error;
  end

  # Raised when FullContact returns the HTTP status code 404
  class NotFound < Error;
  end

  # Raised when FullContact returns the HTTP status code 422
  class Invalid < Error;
  end

  # Raised when FullContact returns the HTTP status code 429
  class RateLimited < Error;
  end

  # Raised when FullContact returns the HTTP status code 500
  class InternalServerError < Error;
  end

  # Raised when FullContact returns the HTTP status code 502
  class BadGateway < Error;
  end

  # Raised when FullContact returns the HTTP status code 503
  class ServiceUnavailable < Error;
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
fullcontact-api-ruby-0.1.0 lib/fullcontact/error.rb
fullcontact-0.18.0 lib/fullcontact/error.rb
fullcontact-0.17.0 lib/fullcontact/error.rb
fullcontact-0.16.0 lib/fullcontact/error.rb
fullcontact-0.15.0 lib/fullcontact/error.rb
fullcontact-0.14.0 lib/fullcontact/error.rb
fullcontact-0.13.0 lib/fullcontact/error.rb
fullcontact-0.12.0 lib/fullcontact/error.rb
fullcontact-0.11.0 lib/fullcontact/error.rb
fullcontact-0.10.0 lib/fullcontact/error.rb
fullcontact-0.9.0 lib/fullcontact/error.rb
fullcontact-0.8.2 lib/fullcontact/error.rb