[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication - ZopePublication.py:1.12

Steve Alexander steve@cat-box.net
Mon, 11 Nov 2002 09:15:44 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/ZopePublication
In directory cvs.zope.org:/tmp/cvs-serv4172/lib/python/Zope/App/ZopePublication

Modified Files:
	ZopePublication.py 
Log Message:
ZopePublication is now responsible for swallowing and logging errors
raised while reporting errors in the ErrorReportingService.
This was previously the responsibility of the ErrorReportingService.



=== Zope3/lib/python/Zope/App/ZopePublication/ZopePublication.py 1.11 => 1.12 ===
--- Zope3/lib/python/Zope/App/ZopePublication/ZopePublication.py:1.11	Wed Oct 23 13:05:59 2002
+++ Zope3/lib/python/Zope/App/ZopePublication/ZopePublication.py	Mon Nov 11 09:15:44 2002
@@ -12,13 +12,11 @@
 # 
 ##############################################################################
 import sys
-from types import StringType, ClassType
 from zLOG import LOG, ERROR, INFO
 
 from Zope.ComponentArchitecture import getService
 from Zope.ComponentArchitecture.Exceptions import ComponentLookupError
 from ZODB.POSException import ConflictError
-from Zope.ComponentArchitecture import getService
 
 from Zope.Publisher.DefaultPublication import DefaultPublication
 from Zope.Publisher.mapply import mapply
@@ -41,8 +39,6 @@
 from Zope.App.Security.IUnauthenticatedPrincipal \
      import IUnauthenticatedPrincipal
 
-from Zope.App.OFS.Content.Folder.RootFolder import RootFolder
-
 from PublicationTraverse import PublicationTraverse
 
 from Zope.Proxy.ContextWrapper import ContextWrapper
@@ -50,8 +46,6 @@
 # XXX Should this be imported here?
 from Transaction import get_transaction
 
-from Zope.App.ComponentArchitecture.NextService import queryNextService
-
 class RequestContainer:
     # TODO: add security assertion declaring access to REQUEST
 
@@ -182,9 +176,28 @@
 
             try:
                 errService = getService(object,'ErrorReportingService')
-                errService.raising(exc_info, request)
             except ComponentLookupError:
                 pass
+            else:
+                try:
+                    errService.raising(exc_info, request)
+                # It is important that an error in errService.raising
+                # does not propagate outside of here. Otherwise, nothing
+                # meaningful will be returned to the user.
+                #
+                # The error reporting service should not be doing database
+                # stuff, so we shouldn't get a conflict error.
+                # Even if we do, it is more important that we log this
+                # error, and proceed with the normal course of events.
+                # We should probably (somehow!) append to the standard
+                # error handling that this error occurred while using
+                # the ErrorReportingService, and that it will be in
+                # the zope log.
+                except:
+                    LOG('SiteError', ERROR,
+                        'Error while reporting an error to the '
+                        'ErrorReportingService', 
+                        error=sys.exc_info())
 
             # Delegate Unauthorized errors to the authentication service
             # XXX Is this the right way to handle Unauthorized?  We need