[Neo-report] r2013 vincent - in /trunk/neo: client/handlers/ tests/client/

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Apr 23 11:32:13 CEST 2010


Author: vincent
Date: Fri Apr 23 11:32:12 2010
New Revision: 2013

Log:
Don't raise generic exceptions in NEO if they can reach user.

Modified:
    trunk/neo/client/handlers/storage.py
    trunk/neo/tests/client/testStorageHandler.py

Modified: trunk/neo/client/handlers/storage.py
==============================================================================
--- trunk/neo/client/handlers/storage.py [iso-8859-1] (original)
+++ trunk/neo/client/handlers/storage.py [iso-8859-1] Fri Apr 23 11:32:12 2010
@@ -20,6 +20,7 @@
 from neo.client.handlers import BaseHandler, AnswerBaseHandler
 from neo.protocol import NodeTypes, ProtocolError
 from neo.util import dump
+from neo.client.exception import NEOStorageError
 
 class StorageEventHandler(BaseHandler):
 
@@ -61,7 +62,7 @@
     def answerObject(self, conn, oid, start_serial, end_serial,
             compression, checksum, data, data_serial):
         if data_serial is not None:
-            raise ValueError, 'Storage should never send non-None ' \
+            raise NEOStorageError, 'Storage should never send non-None ' \
                 'data_serial to clients, got %s' % (dump(data_serial), )
         self.app.local_var.asked_object = (oid, start_serial, end_serial,
                 compression, checksum, data)

Modified: trunk/neo/tests/client/testStorageHandler.py
==============================================================================
--- trunk/neo/tests/client/testStorageHandler.py [iso-8859-1] (original)
+++ trunk/neo/tests/client/testStorageHandler.py [iso-8859-1] Fri Apr 23 11:32:12 2010
@@ -21,6 +21,7 @@
 from neo.protocol import NodeTypes
 from neo.client.handlers.storage import StorageBootstrapHandler, \
        StorageAnswersHandler
+from neo.client.exception import NEOStorageError
 
 MARKER = []
 
@@ -83,7 +84,8 @@
         # Check handler raises on non-None data_serial.
         the_object = (oid, tid1, tid2, 0, '', 'DATA', self.getNextTID())
         self.app.local_var.asked_object = None
-        self.assertRaises(ValueError, self.handler.answerObject, conn, *the_object)
+        self.assertRaises(NEOStorageError, self.handler.answerObject, conn,
+            *the_object)
 
     def test_answerStoreObject(self):
         conn = self.getConnection()





More information about the Neo-report mailing list