Add custom exception and raise InvalidInputText when 'text' is boolean on parser

This commit is contained in:
Larry Kim committed 2013-06-06 02:49:44 +09:00
1 parent 7aea99b3f9
commit 496048ec12
2 files changed
+10

No files matched your search

+6
View File
@@ -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)
+4
View File
@@ -46,6 +46,10 @@ class Parser(object):
logging.debug("__init__: DEBUG is set to True") logging.debug("__init__: DEBUG is set to True")
self.domain = unicode(domain, "utf-8").encode("idna") self.domain = unicode(domain, "utf-8").encode("idna")
if not text:
raise error.InvalidInputText(text)
self.text = text self.text = text
self.whoisServer = whoisServer and whoisServer or "default" self.whoisServer = whoisServer and whoisServer or "default"