diff --git a/whois/error.py b/whois/error.py index e69de29..127f42b 100644 --- a/whois/error.py +++ b/whois/error.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- + +class InvalidInputText(Exception): + def __init__(self, text): + self.message = "Invalid input text: %s"%(text) + Exception.__init__(self, self.message) diff --git a/whois/parser.py b/whois/parser.py index 79e1520..2b111cc 100644 --- a/whois/parser.py +++ b/whois/parser.py @@ -46,6 +46,10 @@ class Parser(object): logging.debug("__init__: DEBUG is set to True") self.domain = unicode(domain, "utf-8").encode("idna") + + if not text: + raise error.InvalidInputText(text) + self.text = text self.whoisServer = whoisServer and whoisServer or "default"