class NotEnoughServersError(Exception):
"""There were not enough functioning servers available to place shares
- upon."""
+ upon. This might result from all servers being full or having an error, a
+ local bug which causes all server requests to fail in the same way, or
+ from there being zero servers. The first error received (if any) is
+ stored in my .first_error attribute."""
+ def __init__(self, why, first_error=None):
+ Exception.__init__(self, why, first_error)
+ self.first_error = first_error
class CorruptShareError(Exception):
def __init__(self, peerid, shnum, reason):
num = self._node._client.log("Publish(%s): starting" % prefix)
self._log_number = num
self._running = True
+ self._first_write_error = None
self._status = PublishStatus()
self._status.set_storage_index(self._storage_index)
peerlist.sort()
if not peerlist:
- raise NotEnoughServersError("Ran out of non-bad servers")
+ raise NotEnoughServersError("Ran out of non-bad servers, "
+ "first_error=%s" %
+ str(self._first_write_error),
+ self._first_write_error)
new_assignments = []
# we then index this peerlist with an integer, because we may have to
for shnum in shnums:
self.outstanding.discard( (peerid, shnum) )
self.bad_peers.add(peerid)
+ if self._first_write_error is None:
+ self._first_write_error = f
self.log(format="error while writing shares %(shnums)s to peerid %(peerid)s",
shnums=list(shnums), peerid=idlib.shortnodeid_b2a(peerid),
failure=f,