vitess-gh/py/vtdb/dbexceptions.py

87 строки
1.8 KiB
Python
Исходник Обычный вид История

2012-02-25 11:30:03 +04:00
import exceptions
2012-02-25 11:30:03 +04:00
class Error(exceptions.StandardError):
pass
2013-05-31 11:05:53 +04:00
class DatabaseError(exceptions.StandardError):
2012-02-25 11:30:03 +04:00
pass
class DataError(DatabaseError):
pass
2013-05-31 11:05:53 +04:00
class Warning(exceptions.StandardError):
2012-02-25 11:30:03 +04:00
pass
2013-05-31 11:05:53 +04:00
class InterfaceError(Error):
2012-02-25 11:30:03 +04:00
pass
2012-02-25 11:30:03 +04:00
class InternalError(DatabaseError):
pass
2012-02-25 11:30:03 +04:00
class OperationalError(DatabaseError):
pass
2012-02-25 11:30:03 +04:00
class ProgrammingError(DatabaseError):
pass
2013-05-31 11:05:53 +04:00
class NotSupportedError(ProgrammingError):
2012-02-25 11:30:03 +04:00
pass
2013-05-31 11:05:53 +04:00
class IntegrityError(DatabaseError):
2012-02-25 11:30:03 +04:00
pass
2013-05-31 11:05:53 +04:00
class PartialCommitError(IntegrityError):
2012-02-25 11:30:03 +04:00
pass
# Below errors are VT specific
# Retry means a simple and immediate reconnect to the same host/port
# will likely fix things. This is initiated by a graceful restart on
# the server side. In general this can be handled transparently
# unless the error is within a transaction.
class RetryError(OperationalError):
pass
# This failure is "permanent" - retrying on this host is futile. Push the error
# up in case the upper layers can gracefully recover by reresolving a suitable
# endpoint.
class FatalError(OperationalError):
pass
# This failure is operational in the sense that we must teardown the
# connection to ensure future RPCs are handled correctly.
class TimeoutError(OperationalError):
pass
class TxPoolFull(DatabaseError):
pass
# TransientError is raised for an error that is expected to go away soon. These
# errors should be retried. Examples: when a client exceedes allocated quota on
# a server, or when there's a backlog of requests and new ones are temporarily
# being rejected.
class TransientError(DatabaseError):
pass
2014-08-28 03:54:13 +04:00
# TODO(aaijazi): These are deprecated. They will be replaced by TransientError.
2014-08-28 03:54:13 +04:00
# ThrottledError is raised when client exceeds allocated quota on the server
class ThrottledError(DatabaseError):
2014-08-28 03:54:13 +04:00
pass