From a1665a1ef43ed7aa92129e300208634d4d53f0af Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Thu, 5 Sep 2013 19:03:02 +0100 Subject: [PATCH] Sun Jan 8 22:12:47 GMT 2012 Brian Warner * mutable/layout.py: raise BadShareError instead of assert() --- src/allmydata/mutable/common.py | 12 ++++++--- src/allmydata/mutable/layout.py | 44 ++++++++++++++++++++++++--------- 2 files changed, 41 insertions(+), 15 deletions(-) diff --git a/src/allmydata/mutable/common.py b/src/allmydata/mutable/common.py index c8960c0e..9ce8e37c 100644 --- a/src/allmydata/mutable/common.py +++ b/src/allmydata/mutable/common.py @@ -11,7 +11,13 @@ MODE_REPAIR = "MODE_REPAIR" # query all peers, get the privkey class NotWriteableError(Exception): pass -class NeedMoreDataError(Exception): +class BadShareError(Exception): + """This represents an error discovered in a particular share, during + retrieve, from which we can recover by using some other share. This does + *not* include local coding errors. + """ + +class NeedMoreDataError(BadShareError): def __init__(self, needed_bytes, encprivkey_offset, encprivkey_length): Exception.__init__(self) self.needed_bytes = needed_bytes # up through EOF @@ -41,7 +47,7 @@ class NotEnoughServersError(Exception): Exception.__init__(self, why, first_error) self.first_error = first_error -class CorruptShareError(Exception): +class CorruptShareError(BadShareError): def __init__(self, server, shnum, reason): self.args = (server, shnum, reason) self.server = server @@ -51,7 +57,7 @@ class CorruptShareError(Exception): return "