gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leosim...@apache.org
Subject svn commit: r124564 - /gump/branches/Gump3/pygump/python/gump/plugins/__init__.py
Date Fri, 07 Jan 2005 19:38:55 GMT
Author: leosimons
Date: Fri Jan  7 11:38:53 2005
New Revision: 124564

URL: http://svn.apache.org/viewcvs?view=rev&rev=124564
Log:
Fix error handling bugs
Modified:
   gump/branches/Gump3/pygump/python/gump/plugins/__init__.py

Modified: gump/branches/Gump3/pygump/python/gump/plugins/__init__.py
Url: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/plugins/__init__.py?view=diff&rev=124564&p1=gump/branches/Gump3/pygump/python/gump/plugins/__init__.py&r1=124563&p2=gump/branches/Gump3/pygump/python/gump/plugins/__init__.py&r2=124564
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/plugins/__init__.py	(original)
+++ gump/branches/Gump3/pygump/python/gump/plugins/__init__.py	Fri Jan  7 11:38:53 2005
@@ -24,9 +24,11 @@
     
     This handler just re-raises a caught error.
     """
-    def handle(visitor, error, visited_model_object):
+    def handle(self, visitor, visited_model_object):
         """Override this method to be able to swallow exceptions."""
-        raise error
+        import sys
+        (type, value, traceback) = sys.exc_info()
+        raise type, value
 
 class LoggingErrorHandler:
     """Logging error handler for use with the MulticastPlugin.
@@ -36,10 +38,12 @@
     def __init__(self, log):
         self.log = log
 
-    def handle(visitor, error, visited_model_object):
+    def handle(self, visitor, visited_model_object):
         """Override this method to be able to swallow exceptions."""
         self.log.exception("%s threw an exception while visiting %s!" % (visitor, visited_model_object))
-        raise error
+        import sys
+        (type, value, traceback) = sys.exc_info()
+        raise type, value
 
 class AbstractPlugin:
     """Base class for all plugins.
@@ -111,32 +115,32 @@
     def initialize(self):
         for visitor in self.list:
             try: visitor._initialize()
-            except: self.error_handler.handle(visitor, error, "{{{initialization stage}}}")
+            except: self.error_handler.handle(visitor, "{{{initialization stage}}}")
 
     def visit_workspace(self, workspace):
         for visitor in self.list:
             try: visitor._visit_workspace(workspace)
-            except: self.error_handler.handle(visitor, error, workspace)
+            except: self.error_handler.handle(visitor, workspace)
 
     def visit_repository(self, repository):
         for visitor in self.list:
             try: visitor._visit_repository(repository)
-            except: self.error_handler.handle(visitor, error, repository)
+            except: self.error_handler.handle(visitor, repository)
 
     def visit_module(self, module):
         for visitor in self.list:
             try: visitor._visit_module(module)
-            except: self.error_handler.handle(visitor, error, module)
+            except: self.error_handler.handle(visitor, module)
 
     def visit_project(self, project):
         for visitor in self.list:
             try: visitor._visit_project(project)
-            except: self.error_handler.handle(visitor, error, project)
+            except: self.error_handler.handle(visitor, project)
 
     def finalize(self):
         for visitor in self.list:
             try: visitor._finalize()
-            except: self.error_handler.handle(visitor, error, "{{{finalization stage}}}")
+            except: self.error_handler.handle(visitor, "{{{finalization stage}}}")
 
 class LoggingPlugin(AbstractPlugin):
     """Plugin that prints debug messages as it visits model objects."""

Mime
View raw message