Sha256: 580ff6d65db2d3b015c8fb713e78cd45c1e8bfe25d403847f3df524b4148efaa

Contents?: true

Size: 1.44 KB

Versions: 34

Compression:

Stored size: 1.44 KB

Contents

module Totter
  # Standard Totter error
  class Error < StandardError; end

  # Raised when Totter returns a 400 HTTP status code
  class BadRequest < Error; end

  # Raised when Totter returns a 401 HTTP status code
  class Unauthorized < Error; end

  # Raised when Totter returns a 403 HTTP status code
  class Forbidden < Error; end

  # Raised when Totter returns a 404 HTTP status code
  class NotFound < Error; end

  # Raised when Totter returns a 406 HTTP status code
  class NotAcceptable < Error; end

  # Raised when Totter returns a 422 HTTP status code
  class UnprocessableEntity < Error; end

  # Raised when Totter returns a 500 HTTP status code
  class InternalServerError < Error; end

  # Raised when Totter returns a 501 HTTP status code
  class NotImplemented < Error; end

  # Raised when Totter returns a 502 HTTP status code
  class BadGateway < Error; end

  # Raised when Totter returns a 503 HTTP status code
  class ServiceUnavailable < Error; end

  # Raised when a unique ID is required but not provided
  class UniqueIDRequired < Error; end

  # Status code to exception map
  ERROR_MAP = {
    400 => Totter::BadRequest,
    401 => Totter::Unauthorized,
    403 => Totter::Forbidden,
    404 => Totter::NotFound,
    406 => Totter::NotAcceptable,
    422 => Totter::UnprocessableEntity,
    500 => Totter::InternalServerError,
    501 => Totter::NotImplemented,
    502 => Totter::BadGateway,
    503 => Totter::ServiceUnavailable
  }
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
totter-0.2.13 lib/totter/error.rb
totter-0.2.12 lib/totter/error.rb
totter-0.2.11 lib/totter/error.rb
totter-0.2.10 lib/totter/error.rb
totter-0.2.9 lib/totter/error.rb
totter-0.2.8 lib/totter/error.rb
totter-0.2.7 lib/totter/error.rb
totter-0.2.6 lib/totter/error.rb
totter-0.2.5 lib/totter/error.rb
totter-0.2.4 lib/totter/error.rb
totter-0.2.3 lib/totter/error.rb
totter-0.2.2 lib/totter/error.rb
totter-0.2.1 lib/totter/error.rb
totter-0.2.0 lib/totter/error.rb