Don't wrap MySQLError with MySQLError.
This commit is contained in:
@@ -44,6 +44,7 @@ from .err import (
|
|||||||
raise_mysql_exception, Warning, Error,
|
raise_mysql_exception, Warning, Error,
|
||||||
InterfaceError, DataError, DatabaseError, OperationalError,
|
InterfaceError, DataError, DatabaseError, OperationalError,
|
||||||
IntegrityError, InternalError, NotSupportedError, ProgrammingError)
|
IntegrityError, InternalError, NotSupportedError, ProgrammingError)
|
||||||
|
from . import err
|
||||||
|
|
||||||
_py_version = sys.version_info[:2]
|
_py_version = sys.version_info[:2]
|
||||||
|
|
||||||
@@ -832,15 +833,18 @@ class Connection(object):
|
|||||||
|
|
||||||
if self.autocommit_mode is not None:
|
if self.autocommit_mode is not None:
|
||||||
self.autocommit(self.autocommit_mode)
|
self.autocommit(self.autocommit_mode)
|
||||||
except Exception as e:
|
except BaseException as e:
|
||||||
self._rfile = None
|
self._rfile = None
|
||||||
if sock is not None:
|
if sock is not None:
|
||||||
try:
|
try:
|
||||||
sock.close()
|
sock.close()
|
||||||
except socket.error:
|
except socket.error:
|
||||||
pass
|
pass
|
||||||
|
if isinstance(e, err.MySQLError):
|
||||||
|
raise
|
||||||
raise OperationalError(
|
raise OperationalError(
|
||||||
2003, "Can't connect to MySQL server on %r (%s)" % (self.host, e))
|
2003,
|
||||||
|
"Can't connect to MySQL server on %r (%s)" % (self.host, e))
|
||||||
|
|
||||||
def _read_packet(self, packet_type=MysqlPacket):
|
def _read_packet(self, packet_type=MysqlPacket):
|
||||||
"""Read an entire "mysql packet" in its entirety from the network
|
"""Read an entire "mysql packet" in its entirety from the network
|
||||||
|
|||||||
Reference in New Issue
Block a user