Sha256: 10a893d195f934eae252ad26b9eb6415819460b3597f9fa80bc9717171b80eb8

Contents?: true

Size: 1007 Bytes

Versions: 13

Compression:

Stored size: 1007 Bytes

Contents

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

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

  end

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

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

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

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

  # Raised when Cashstar returns the HTTP status code 406
  class NotAcceptable < Error; end

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

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

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

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
cashstar-ruby-0.2.4 lib/cashstar/error.rb
cashstar-ruby-0.2.3 lib/cashstar/error.rb
cashstar-ruby-0.2.2 lib/cashstar/error.rb
cashstar-ruby-0.2.1 lib/cashstar/error.rb
cashstar-ruby-0.2.0 lib/cashstar/error.rb
cashstar-ruby-0.1.8 lib/cashstar/error.rb
cashstar-ruby-0.1.7 lib/cashstar/error.rb
cashstar-0.1.5 lib/cashstar/error.rb
cashstar-0.1.4 lib/cashstar/error.rb
cashstar-0.1.3 lib/cashstar/error.rb
cashstar-0.1.2 lib/cashstar/error.rb
cashstar-0.1.1 lib/cashstar/error.rb
cashstar-0.1.0 lib/cashstar/error.rb