mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-23 23:02:25 +00:00
give the ContainerVersionError exceptions a nice str
This commit is contained in:
parent
3a8432713f
commit
e8adca40ab
@ -21,6 +21,12 @@ class UnknownContainerVersionError(Exception):
|
||||
self.filename = filename
|
||||
self.version = version
|
||||
|
||||
def __str__(self):
|
||||
return "sharefile {!r} had unexpected version {!r}".format(
|
||||
self.filename,
|
||||
self.version,
|
||||
)
|
||||
|
||||
class UnknownMutableContainerVersionError(UnknownContainerVersionError):
|
||||
pass
|
||||
|
||||
|
@ -651,6 +651,7 @@ class Server(unittest.TestCase):
|
||||
ss.remote_get_buckets, b"si1")
|
||||
self.assertEqual(e.filename, fn)
|
||||
self.assertEqual(e.version, 0)
|
||||
self.assertIn("had unexpected version 0", str(e))
|
||||
|
||||
def test_disconnect(self):
|
||||
# simulate a disconnection
|
||||
@ -1136,6 +1137,8 @@ class MutableServer(unittest.TestCase):
|
||||
read, b"si1", [0], [(0,10)])
|
||||
self.assertEqual(e.filename, fn)
|
||||
self.assertTrue(e.version.startswith(b"BAD MAGIC"))
|
||||
self.assertIn("had unexpected version", str(e))
|
||||
self.assertIn("BAD MAGIC", str(e))
|
||||
|
||||
def test_container_size(self):
|
||||
ss = self.create("test_container_size")
|
||||
|
Loading…
Reference in New Issue
Block a user