Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 143 lines (104 sloc) 3.536 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
#--
# Ruby Whois
#
# An intelligent pure Ruby WHOIS client and parser.
#
# Copyright (c) 2009-2011 Simone Carletti <weppos@weppos.net>
#++


module Whois

  # The base error class for all <tt>Whois</tt> error classes.
  class Error < StandardError
  end

  # Raised when the connection to the WHOIS server fails.
  class ConnectionError < Error
  end


  # @group Server

  # Generic class for server errors.
  class ServerError < Error
  end


  # Raised when the class hasn't been able to select a valid server
  # probably because definitions are outdated.
  #
  # Definition is not recognized.
  class ServerNotFound < ServerError
  end


  # Raised when we know about a specific functionality
  # but this functionality has not been implemented yet.
  # This is usually the result of a porting from a third-party library.
  #
  # Definition is recognized.
  class ServerNotImplemented < ServerError
  end

  # Raised when no WHOIS server is known for this kind of object. (\x05)
  #
  # Definition is recognized.
  class ServerNotSupported < ServerError
  end

  # Raised when unknown AS number of IP network. (\x06)
  #
  # Definition is recognized.
  class AllocationUnknown < ServerError
  end

  # @endgroup


  # @group Interface

  # Generic class for interfaces not supported.
  class InterfaceNotSupported < ServerError
  end

  # Raised when a server is known to not be available for this kind of object
  # or because this specific object doesn't support WHOIS. (\x03)
  class NoInterfaceError < InterfaceNotSupported
  end

  # Raised when the class has found a server but it doesn't support the
  # standard WHOIS interface via port 43. This is the case of some
  # specific domains that only provide a web–based WHOIS interface. (\x01)
  class WebInterfaceError < InterfaceNotSupported

    # @return [String] The URL of the web-based WHOIS interface.
    attr_reader :url

    # Initializes a new exception with given URL.
    #
    # @param [String] url The URL of the web-based WHOIS interface.
    def initialize(url)
      @url = url
      super("This TLD has no WHOIS server, but you can access the WHOIS database at `#{@url}'")
    end

  end

  # @endgroup


  # @group Parser

  # Generic class for parser errors.
  class ParserError < Error
  end

  # Raised when the library hasn't been able to load a valid parser
  # according to current settings and you're trying to access a property
  # that requires a valid parser.
  class ParserNotFound < ParserError
  end

  # Raised when the property method has not been overwritten (implemented)
  # in a child parser class.
  class PropertyNotImplemented < ParserError
  end

  # Raised when you are trying to access a property that is not supported
  # for the current WHOIS record.
  class PropertyNotSupported < ParserError
  end

  # Raised when you are trying to access a property that is not supported
  # by any of the parsers available for current WHOIS record.
  class PropertyNotAvailable < ParserError
  end

  # @endgroup


  # @group Response

  # Generic class for response errors.
  class ResponseError < Error
  end

  # Raised when attempting to access a property when the response is throttled.
  #
  # @see Whois::Record::Parser::Base#response_throttled?
  class ResponseIsThrottled < ResponseError
  end

  # Raised when attempting to access a property when the response is unavailable.
  #
  # @since 2.0.3
  # @see Whois::Record::Parser::Base#response_unavailable?
  class ResponseIsUnavailable < ResponseError
  end

  # @endgroup

end
Something went wrong with that request. Please try again.