Add custom exception and raise InvalidInputText when 'text' is boolean on parser
This commit is contained in:
parent
7aea99b3f9
commit
496048ec12
@ -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)
|
||||||
@ -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"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user