Remove some unnecessary log messages and use better Exceptions.
[quix0rs-apt-p2p.git] / apt_p2p_Khashmir / knode.py
index 9acf9b777392857cfa247dd4d40505ba3338abac..2cefe236b93e36455b66e46ffccd43d8fb11f630 100644 (file)
@@ -7,6 +7,9 @@ from twisted.python import log
 
 from node import Node, NULL_ID
 
+class KNodeError(Exception):
+    """An error occurred in contacting the node."""
+
 class KNodeBase(Node):
     """A basic node that can only be pinged and help find other nodes."""
     
@@ -16,12 +19,12 @@ class KNodeBase(Node):
             senderid = dict['id']
         except KeyError:
             log.msg("No peer id in response")
-            raise Exception, "No peer id in response."
+            raise KNodeError, "No peer id in response."
         else:
             if self.id != NULL_ID and senderid != self.id:
                 log.msg("Got response from different node than expected.")
                 self.table.invalidateNode(self)
-                raise Exception, "Node ID has changed"
+                raise KNodeError, "Node ID has changed"
                 
         return dict