Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 97 lines (75 sloc) 2.576 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
#
# = Ruby Whois
#
# An intelligent pure Ruby WHOIS client and parser.
#
#
# Category:: Net
# Package:: Whois
# Author:: Simone Carletti <weppos@weppos.net>
# License:: MIT License
#
#--
#
#++


module Whois

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


  # Generic <tt>Whois::Server</tt> exception class.
  class ServerError < Error
  end

  # Server Definition not found

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

  # Server Definition found

  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
    attr_reader :url
    def initialize(url)
      @url = url
      super("This TLD has no whois server, but you can access the whois database at `#{@url}'")
    end
  end

  # Server Known object, Definition unavailable

  # 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.
  class ServerNotImplemented < ServerError
  end

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

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


  # Generic <tt>Whois::Answer::Parser</tt> exception class.
  class ParserError < Error
  end

  # Raised when the class hasn't been able to load a valid parser
  # according to current settings.
  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 answer.
  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 answer.
  class PropertyNotAvailable < ParserError
  end

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