[CalendarServer-changes] [10991] CalendarServer/trunk/twistedcaldav/method

source_changes at macosforge.org source_changes at macosforge.org
Wed Apr 3 10:09:28 PDT 2013


Revision: 10991
          http://trac.calendarserver.org//changeset/10991
Author:   cdaboo at apple.com
Date:     2013-04-03 10:09:28 -0700 (Wed, 03 Apr 2013)
Log Message:
-----------
Propagate original tracebacks out of put_*_common.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/method/put_addressbook_common.py
    CalendarServer/trunk/twistedcaldav/method/put_common.py

Modified: CalendarServer/trunk/twistedcaldav/method/put_addressbook_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/put_addressbook_common.py	2013-04-03 15:25:39 UTC (rev 10990)
+++ CalendarServer/trunk/twistedcaldav/method/put_addressbook_common.py	2013-04-03 17:09:28 UTC (rev 10991)
@@ -20,6 +20,7 @@
 
 __all__ = ["StoreAddressObjectResource"]
 
+import sys
 import types
 
 from twisted.internet import reactor
@@ -485,12 +486,18 @@
 
             returnValue(response)
 
-        except Exception, err:
+        except Exception:
 
+            # Grab the current exception state here so we can use it in a re-raise - we need this because
+            # an inlineCallback might be called and that raises an exception when it returns, wiping out the
+            # original exception "context".
+            ex = sys.exc_info()
+
             if reservation:
                 yield reservation.unreserve()
 
-            raise err
+            # Re-raise using original exception state
+            raise ex[0], ex[1], ex[2]
 
 
     @inlineCallbacks
@@ -576,9 +583,15 @@
 
             returnValue(response)
 
-        except Exception, err:
+        except Exception:
 
+            # Grab the current exception state here so we can use it in a re-raise - we need this because
+            # an inlineCallback might be called and that raises an exception when it returns, wiping out the
+            # original exception "context".
+            ex = sys.exc_info()
+
             if reservation:
                 yield reservation.unreserve()
 
-            raise err
+            # Re-raise using original exception state
+            raise ex[0], ex[1], ex[2]

Modified: CalendarServer/trunk/twistedcaldav/method/put_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/put_common.py	2013-04-03 15:25:39 UTC (rev 10990)
+++ CalendarServer/trunk/twistedcaldav/method/put_common.py	2013-04-03 17:09:28 UTC (rev 10991)
@@ -21,6 +21,7 @@
 
 __all__ = ["StoreCalendarObjectResource"]
 
+import sys
 import types
 import uuid
 from urlparse import urlparse, urlunparse
@@ -1334,6 +1335,11 @@
 
         except Exception, err:
 
+            # Grab the current exception state here so we can use it in a re-raise - we need this because
+            # an inlineCallback might be called and that raises an exception when it returns, wiping out the
+            # original exception "context".
+            ex = sys.exc_info()
+
             if reservation:
                 yield reservation.unreserve()
 
@@ -1356,7 +1362,8 @@
                     "Invalid Managed-ID parameter in calendar data",
                 ))
             else:
-                raise err
+                # Re-raise using original exception state
+                raise ex[0], ex[1], ex[2]
 
 
     @inlineCallbacks
@@ -1452,6 +1459,11 @@
 
         except Exception, err:
 
+            # Grab the current exception state here so we can use it in a re-raise - we need this because
+            # an inlineCallback might be called and that raises an exception when it returns, wiping out the
+            # original exception "context".
+            ex = sys.exc_info()
+
             if reservation:
                 yield reservation.unreserve()
 
@@ -1474,4 +1486,5 @@
                     "Invalid Managed-ID parameter in calendar data",
                 ))
             else:
-                raise err
+                # Re-raise using original exception state
+                raise ex[0], ex[1], ex[2]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130403/0cc4e349/attachment-0001.html>


More information about the calendarserver-changes mailing list