From c56839478ef395f6b2bcaedee1fe2aeae0d75903 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Sat, 7 Jan 2012 18:05:08 -0800 Subject: [PATCH] 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 4a04339f..9ce11c53 100644 --- a/src/allmydata/mutable/common.py +++ b/src/allmydata/mutable/common.py @@ -10,7 +10,13 @@ MODE_READ = "MODE_READ" 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 @@ -40,7 +46,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 @@ -50,7 +56,7 @@ class CorruptShareError(Exception): return "