8000 Use OperationalError for unknown error with code>1000. (#823) · rainingmaster/PyMySQL@c3e5a63 · GitHub
[go: up one dir, main page]

Skip to content

Commit c3e5a63

Browse files
authored
Use OperationalError for unknown error with code>1000. (PyMySQL#823)
Fixes PyMySQL#816.
1 parent 9dcefe9 commit c3e5a63

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pymysql/err.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,7 @@ def _map_error(exc, *errors):
100100
def raise_mysql_exception(data):
101101
errno = struct.unpack('<h', data[1:3])[0]
102102
errval = data[9:].decode('utf-8', 'replace')
103-
errorclass = error_map.get(errno, InternalError)
103+
errorclass = error_map.get(errno)
104+
if errorclass is None:
105+
errorclass = InternalError if errno < 1000 else OperationalError
104106
raise errorclass(errno, errval)

0 commit comments

Comments
 (0)
0