Skip to content

Commit

Permalink
Use OperationalError for unknown error with code>1000. (#823)
Browse files Browse the repository at this point in the history
Fixes #816.
  • Loading branch information
methane committed Nov 13, 2019
1 parent 9dcefe9 commit c3e5a63
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pymysql/err.py
Expand Up @@ -100,5 +100,7 @@ def _map_error(exc, *errors):
def raise_mysql_exception(data):
errno = struct.unpack('<h', data[1:3])[0]
errval = data[9:].decode('utf-8', 'replace')
errorclass = error_map.get(errno, InternalError)
errorclass = error_map.get(errno)
if errorclass is None:
errorclass = InternalError if errno < 1000 else OperationalError
raise errorclass(errno, errval)

0 comments on commit c3e5a63

Please sign in to comment.