[Zope-Checkins] CVS: Zope3/lib/python/Zope/Exceptions - ExceptionFormatter.py:1.1.2.3

Fred L. Drake, Jr. fdrake@acm.org
Thu, 21 Mar 2002 17:40:57 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Exceptions
In directory cvs.zope.org:/tmp/cvs-serv29195

Modified Files:
      Tag: Zope-3x-branch
	ExceptionFormatter.py 
Log Message:
Only put the code which might be raising an exception inside a try/except.

=== Zope3/lib/python/Zope/Exceptions/ExceptionFormatter.py 1.1.2.2 => 1.1.2.3 ===
         result.append(self.escape(s))
 
-        try:
-            # Output a traceback supplement, if any.
-            if locals.has_key('__traceback_supplement__'):
-                # Use the supplement defined in the function.
-                tbs = locals['__traceback_supplement__']
-            elif globals.has_key('__traceback_supplement__'):
-                # Use the supplement defined in the module.
-                # This is used by Scripts (Python).
-                tbs = globals['__traceback_supplement__']
-            else:
-                tbs = None
-            if tbs is not None:
-                factory = tbs[0]
-                args = tbs[1:]
+        # Output a traceback supplement, if any.
+        if locals.has_key('__traceback_supplement__'):
+            # Use the supplement defined in the function.
+            tbs = locals['__traceback_supplement__']
+        elif globals.has_key('__traceback_supplement__'):
+            # Use the supplement defined in the module.
+            # This is used by Scripts (Python).
+            tbs = globals['__traceback_supplement__']
+        else:
+            tbs = None
+        if tbs is not None:
+            factory = tbs[0]
+            args = tbs[1:]
+            try:
                 supp = factory(*args)
                 result.extend(self.formatSupplement(supp, tb))
-        except:
-            if DEBUG_EXCEPTION_FORMATTER:
-                import traceback
-                traceback.print_exc()
-            # else just swallow the exception.
+            except:
+                if DEBUG_EXCEPTION_FORMATTER:
+                    import traceback
+                    traceback.print_exc()
+                # else just swallow the exception.
 
         try:
             tbi = locals.get('__traceback_info__', None)