From: Zooko O'Whielacronx <zooko@zooko.com>
Date: Thu, 8 Jan 2009 05:25:51 +0000 (-0700)
Subject: immutable: do not catch arbitrary exceptions/failures from the attempt to get a crypt... 
X-Git-Url: https://git.rkrishnan.org/%5B/frontends?a=commitdiff_plain;h=6011f4522f5e49339d7dbc05dc7cd21616185f0a;p=tahoe-lafs%2Ftahoe-lafs.git

immutable: do not catch arbitrary exceptions/failures from the attempt to get a crypttext hash tree -- catch only ServerFailure, IntegrityCheckReject, LayoutInvalid, ShareVersionIncompatible, and DeadReferenceError
Once again I inserted a bug into the code, and once again it was hidden by something catching arbitrary exception/failure and assuming that it means the server failed to provide valid data.
---

diff --git a/src/allmydata/immutable/download.py b/src/allmydata/immutable/download.py
index c63dccc7..c3104ded 100644
--- a/src/allmydata/immutable/download.py
+++ b/src/allmydata/immutable/download.py
@@ -124,9 +124,14 @@ class ValidatedThingObtainer:
         self._log_id = log_id
 
     def _bad(self, f, validatedthingproxy):
+        failtype = f.trap(ServerFailure, IntegrityCheckReject, layout.LayoutInvalid, layout.ShareVersionIncompatible, DeadReferenceError)
         level = log.WEIRD
         if f.check(DeadReferenceError):
             level = log.UNUSUAL
+        elif f.check(ServerFailure):
+            level = log.WEIRD
+        else:
+            level = log.SCARY
         log.msg(parent=self._log_id, facility="tahoe.immutable.download",
                 format="operation %(op)s from validatedthingproxy %(validatedthingproxy)s failed",
                 op=self._debugname, validatedthingproxy=str(validatedthingproxy),