From 6011f4522f5e49339d7dbc05dc7cd21616185f0a Mon Sep 17 00:00:00 2001
From: Zooko O'Whielacronx <zooko@zooko.com>
Date: Wed, 7 Jan 2009 22:25:51 -0700
Subject: [PATCH] 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.

---
 src/allmydata/immutable/download.py | 5 +++++
 1 file changed, 5 insertions(+)

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),
-- 
2.45.2