sqlalchemy.mq / resultproxy-exception

# HG changeset patch
# User Philip Jenvey <pjenvey@underboss.org>
# Date 1303526809 25200
# Node ID 63cf1155c876d56927d7f496bc12c100eabf0697
# Parent  c778071d973b96aaf50ddcae8ebb4242b3ace846
ensure proper cleanup if get_result_proxy triggers an Exception

diff -r c778071d973b -r 63cf1155c876 lib/sqlalchemy/engine/base.py
--- a/lib/sqlalchemy/engine/base.py	Fri Apr 22 19:38:39 2011 -0700
+++ b/lib/sqlalchemy/engine/base.py	Fri Apr 22 19:46:49 2011 -0700
@@ -1551,7 +1551,16 @@
         # create a resultproxy, get rowcount/implicit RETURNING
         # rows, close cursor if no further results pending
-        result = context.get_result_proxy()
+        try:
+            result = context.get_result_proxy()
+        except Exception, e:
+            self._handle_dbapi_exception(
+                                e,
+                                statement,
+                                parameters,
+                                cursor,
+                                context)
+            raise
         if context.isinsert:
             if context._is_implicit_returning:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.