summaryrefslogtreecommitdiffstats
path: root/aioeapi/errors.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 09:24:45 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 09:24:45 +0000
commitb88b57aff93c95ae07f8a2f05a6a577b39cb1f1f (patch)
treea8c2cbdeefe4aba4936c128ebfd4cb600da23dc1 /aioeapi/errors.py
parentInitial commit. (diff)
downloadaio-eapi-b88b57aff93c95ae07f8a2f05a6a577b39cb1f1f.tar.xz
aio-eapi-b88b57aff93c95ae07f8a2f05a6a577b39cb1f1f.zip
Adding upstream version 0.6.3.upstream/0.6.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--aioeapi/errors.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/aioeapi/errors.py b/aioeapi/errors.py
new file mode 100644
index 0000000..1c415b2
--- /dev/null
+++ b/aioeapi/errors.py
@@ -0,0 +1,30 @@
+import httpx
+
+
+class EapiCommandError(RuntimeError):
+ """
+ Exception class for EAPI command errors
+
+ Attributes
+ ----------
+ failed: str - the failed command
+ errmsg: str - a description of the failure reason
+ passed: List[dict] - a list of command results of the commands that passed
+ not_exec: List[str] - a list of commands that were not executed
+ """
+
+ def __init__(self, failed: str, errmsg: str, passed, not_exec):
+ """Initializer for the EapiCommandError exception"""
+ self.failed = failed
+ self.errmsg = errmsg
+ self.passed = passed
+ self.not_exec = not_exec
+ super(EapiCommandError, self).__init__()
+
+ def __str__(self):
+ """returns the error message associated with the exception"""
+ return self.errmsg
+
+
+# alias for exception during sending-receiving
+EapiTransportError = httpx.HTTPStatusError