4 This package seeks to provide semantic error classes that are intended
5 to be used directly by clients when they would like to handle particular
6 semantic failures (e.g. "failed to connect") without needing to know the
7 enumeration of possible reasons for that failure.
9 QMPError serves as the ancestor for all exceptions raised by this
10 package, and is suitable for use in handling semantic errors from this
11 library. In most cases, individual public methods will attempt to catch
12 and re-encapsulate various exceptions to provide a semantic
13 error-handling interface.
15 .. admonition:: QMP Exception Hierarchy Reference
21 | +-- `ExecInterruptedError`
25 | +-- `DeserializationError`
26 | +-- `UnexpectedTypeError`
27 | +-- `ServerParseError`
30 | +-- `NegotiationError`
34 class QMPError(Exception):
35 """Abstract error class for all errors originating from this package."""
38 class ProtocolError(QMPError):
40 Abstract error class for protocol failures.
42 Semantically, these errors are generally the fault of either the
43 protocol server or as a result of a bug in this library.
45 :param error_message: Human-readable string describing the error.
47 def __init__(self, error_message: str):
48 super().__init__(error_message)
49 #: Human-readable error message, without any prefix.
50 self.error_message: str = error_message