immutable: do not catch arbitrary exceptions/failures from the attempt to get a crypt...
authorZooko O'Whielacronx <zooko@zooko.com>
Thu, 8 Jan 2009 05:25:51 +0000 (22:25 -0700)
committerZooko O'Whielacronx <zooko@zooko.com>
Thu, 8 Jan 2009 05:25:51 +0000 (22:25 -0700)
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.

src/allmydata/immutable/download.py

index c63dccc7c6e9961a18fb7480d26778dc094c5b91..c3104ded33f0d576ac1fc46e334b98d0dfd496dd 100644 (file)
@@ -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),