From 16ab0d61ef7e3e324bec71a672983384eba48389 Mon Sep 17 00:00:00 2001 From: Owen Nelson Date: Fri, 28 Dec 2012 20:20:23 -0500 Subject: [PATCH] Fixes issue where GAE error handling can cause AttributeError: 'NoneType' object has no attribute 'group' --- lib/sqlalchemy/dialects/mysql/gaerdbms.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/sqlalchemy/dialects/mysql/gaerdbms.py b/lib/sqlalchemy/dialects/mysql/gaerdbms.py index 54444204eb..5972b2177f 100644 --- a/lib/sqlalchemy/dialects/mysql/gaerdbms.py +++ b/lib/sqlalchemy/dialects/mysql/gaerdbms.py @@ -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) -- 2.47.2