Commit 9f5e14f1 authored by Julien Muchembled's avatar Julien Muchembled

client: raise NEOStorageError instead of POSException.StorageError on protocol error

parent 4039f4da
......@@ -15,12 +15,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from neo.lib import handler
from ZODB.POSException import StorageError, ReadOnlyError
from ..exception import NEOStorageError
from ZODB.POSException import ReadOnlyError
class AnswerBaseHandler(handler.AnswerBaseHandler): # XXX
def protocolError(self, conn, message):
raise StorageError("protocol error: %s" % message)
raise NEOStorageError("protocol error: %s" % message)
def readOnlyAccess(self, conn, message):
raise ReadOnlyError(message)
......@@ -1391,8 +1391,7 @@ class Test(NEOThreadedTest):
client.tpc_begin(None, txn)
txn_context = client._txn_container.get(txn)
txn_context.ttid = add64(txn_context.ttid, 1)
self.assertRaises(POSException.StorageError,
client.tpc_finish, txn)
self.assertRaises(NEOStorageError, client.tpc_finish, txn)
@with_cluster()
def testStorageFailureDuringTpcFinish(self, cluster):
......@@ -1497,7 +1496,7 @@ class Test(NEOThreadedTest):
t, c = cluster.getTransaction()
c.root()['x'] = PCounter() # 1 store() to each storage
with Patch(cluster.client, waitStoreResponses=waitStoreResponses):
self.assertRaises(POSException.StorageError, t.commit)
self.assertRaises(NEOStorageError, t.commit)
self.assertEqual(cluster.neoctl.getClusterState(),
ClusterStates.RUNNING)
......
......@@ -12,6 +12,7 @@ from multiprocessing.queues import SimpleQueue
from struct import Struct
from netfilterqueue import NetfilterQueue
import gevent.socket # preload for subprocesses
from neo.client.exception import NEOStorageError
from neo.client.Storage import Storage
from neo.lib import logging, util
from neo.lib.connector import SocketConnector
......@@ -149,7 +150,7 @@ class Client(Process):
finally:
self.setDSCP(nm, -1)
except (
POSException.StorageError, # XXX: 'already connected' error
NEOStorageError, # XXX: 'already connected' error
POSException.ConflictError, # XXX: same but during conflict resolution
), e:
if 'unexpected packet:' in str(e):
......
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