Skip to content

Commit 8657e2f

Browse files
author
Krzysztof Mioduszewski
committed
Broaden exception scope around connection creation in Pool
Extension of 662546f * Added `InternalError` to possible exceptions as it is raised in case of error codes not mapped to specific exceptions. * Added SERVER_SHUTDOWN to operational errors
1 parent 2065818 commit 8657e2f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tornado_mysql/err.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def _map_error(exc, *errors):
8787
ER.NOT_SUPPORTED_YET, ER.FEATURE_DISABLED, ER.UNKNOWN_STORAGE_ENGINE)
8888
_map_error(OperationalError, ER.DBACCESS_DENIED_ERROR, ER.ACCESS_DENIED_ERROR,
8989
ER.CON_COUNT_ERROR, ER.TABLEACCESS_DENIED_ERROR,
90-
ER.COLUMNACCESS_DENIED_ERROR)
90+
ER.COLUMNACCESS_DENIED_ERROR, ER.SERVER_SHUTDOWN)
9191

9292
del _map_error, ER
9393

tornado_mysql/pools.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
from tornado_mysql import connect
1313
from tornado_mysql.connections import Connection
14-
from tornado_mysql.err import OperationalError
14+
from tornado_mysql.err import OperationalError, InternalError
1515

1616

1717
log = logging.getLogger("tornado_mysql.pools")
@@ -123,7 +123,7 @@ def execute(self, query, params=None, cursor=None):
123123
"""
124124
try:
125125
conn = yield self._get_conn()
126-
except OperationalError:
126+
except (OperationalError, InternalError):
127127
self._after_close()
128128
raise
129129

@@ -149,7 +149,7 @@ def begin(self):
149149
"""
150150
try:
151151
conn = yield self._get_conn()
152-
except OperationalError:
152+
except (OperationalError, InternalError):
153153
self._after_close()
154154
raise
155155

0 commit comments

Comments
 (0)