Commit 74138f0e authored by Vincent Pelletier's avatar Vincent Pelletier

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

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2013 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent fb8ae1a6
......@@ -20,6 +20,7 @@ from ZODB.TimeStamp import TimeStamp
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 @@ class StorageAnswersHandler(AnswerBaseHandler):
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)
......
......@@ -21,6 +21,7 @@ from neo.tests import NeoTestBase
from neo.protocol import NodeTypes
from neo.client.handlers.storage import StorageBootstrapHandler, \
StorageAnswersHandler
from neo.client.exception import NEOStorageError
MARKER = []
......@@ -83,7 +84,8 @@ class StorageAnswerHandlerTests(NeoTestBase):
# 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()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment