Raise AttributeError instead of KeyError
authorEvgeni Kunev <evgeni.kunev@gmail.com>
Tue, 12 Aug 2014 12:54:22 +0300
changeset 30 0ebff1cb6c75
parent 29 1ebe960587b1
child 31 92176112c2d6
Raise AttributeError instead of KeyError This way it's possible to use `getattr`
whois/parser.py
--- a/whois/parser.py	Tue Aug 12 12:51:51 2014 +0300
+++ b/whois/parser.py	Tue Aug 12 12:54:22 2014 +0300
@@ -92,7 +92,7 @@
             setattr(self, attr, values)
             return getattr(self, attr)
         else:
-            raise KeyError('Unknown attribute: %s' % attr)
+            raise AttributeError('Unknown attribute: %s' % attr)
 
     def __str__(self):
         """Print all whois properties of domain