Skip to content

Instantly share code, notes, and snippets.

@morimori
Created April 16, 2009 13:03
Show Gist options
  • Save morimori/96402 to your computer and use it in GitHub Desktop.
Save morimori/96402 to your computer and use it in GitHub Desktop.
HTTP のステータスコードに対応した例外クラス
module HTTP
class BaseError < StandardError; end
class ClientError < BaseError; end
class BadRequest < ClientError; end
class Unauthorized < ClientError; end
class PaymentRequired < ClientError; end
class Forbidden < ClientError; end
class NotFound < ClientError; end
class MethodNotAllowed < ClientError; end
class NotAcceptable < ClientError; end
class ProxyAuthenticationRequired < ClientError; end
class RequestTimeout < ClientError; end
class Conflict < ClientError; end
class Gone < ClientError; end
class LengthRequired < ClientError; end
class PreconditionFailed < ClientError; end
class RequestEntityTooLarge < ClientError; end
class RequestURITooLong < ClientError; end
class UnsupportedMediaType < ClientError; end
class RequestedRangeNotSatisfiable < ClientError; end
class ExpectationFailed < ClientError; end
class Im_a_teapot < ClientError; end
class UnprocessableEntity < ClientError; end
class Locked < ClientError; end
class FailedDependency < ClientError; end
class UnorderedCollection < ClientError; end
class UpgradeRequired < ClientError; end
class ServerError < BaseError; end
class InternalServerError < ServerError; end
class NotImplemented < ServerError; end
class BadGateway < ServerError; end
class ServiceUnavailable < ServerError; end
class GatewayTimeout < ServerError; end
class HTTPVersionNotSupported < ServerError; end
class VariantAlsoNegotiates < ServerError; end
class InsufficientStorage < ServerError; end
class NotExtended < ServerError; end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment