Sha256: 14352ae02f6d8710a0602f9a979ea732f5ffa1b3f17471cc1a656376a687b5a2

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

module Wing
  class Error < StandardError
    NET_HTTP_ERRORS = [
      EOFError,
      Errno::ECONNABORTED,
      Errno::ECONNREFUSED,
      Errno::ECONNRESET,
      Errno::EHOSTUNREACH,
      Errno::EINVAL,
      Errno::ENETUNREACH,
      Net::HTTPBadResponse,
      Net::HTTPHeaderSyntaxError,
      Net::ProtocolError,
      Net::OpenTimeout,
      Net::ReadTimeout,
      SocketError,
      Zlib::GzipFile::Error,
      OpenSSL::SSL::SSLError
    ]
  end

  # Raised on errors in the 400-499 range
  class ResponseError < Error; end

  # Raised when the API returns a 400 HTTP status code
  class BadRequestError < ResponseError; end

  # Raised when the API returns a 401 HTTP status code
  class AuthenticationError < ResponseError; end

  # Raised when the API returns a 404 HTTP status code
  class NotFoundError < ResponseError; end

  # Raised on errors in the 500-599 range
  class ServerError < Error; end

  # Raised when the API returns a 500 HTTP status code
  class InternalServerError < ServerError; end

  # Raised when we can't establish a connection to the API or if reading the reponse times out
  class ConnectionError < Error; end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wing.rb-0.1.2 lib/wing/error.rb
wing.rb-0.1.1 lib/wing/error.rb