]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Fixes issue where GAE error handling can cause AttributeError: 'NoneType' object...
authorOwen Nelson <onelson@gmail.com>
Sat, 29 Dec 2012 01:20:23 +0000 (20:20 -0500)
committerOwen Nelson <onelson@gmail.com>
Sat, 29 Dec 2012 01:20:23 +0000 (20:20 -0500)
lib/sqlalchemy/dialects/mysql/gaerdbms.py

index 54444204eba9bd3e9c994ca197585d6b72e9a1b5..5972b2177fe8f62a610c4f9a4c3361c45febd91e 100644 (file)
@@ -50,7 +50,9 @@ class MySQLDialect_gaerdbms(MySQLDialect_mysqldb):
 
     def _extract_error_code(self, exception):
         match = re.compile(r"^(\d+):").match(str(exception))
-        code = match.group(1)
+        # The rdbms api will wrap then re-raise some types of errors
+        # making this regex return no matches.
+        code = match.group(1) if match else None
         if code:
             return int(code)