aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornico <nico@magicbroccoli.de>2020-06-09 17:52:27 +0200
committernico <nico@magicbroccoli.de>2020-06-09 17:55:00 +0200
commit5cf68897999d33246d47ecaf5469d1f0f4b77b84 (patch)
tree8cc971441c12eb15b242eb22e8b4ff1b8b553df8
parent0e0f9565c2698a66148ce777a17b1ad178d227da (diff)
fix version string being unpopulated
* fix version string being empty + add error code 17 to the README resolves #2 Error Code 17 means one of two things a) the configured user credentials are not correct, therefore the user is not able to properly login b) the configured user does not have the correct permissions to interact with the api
-rw-r--r--README.md9
-rw-r--r--api.py6
2 files changed, 13 insertions, 2 deletions
diff --git a/README.md b/README.md
index 2e956d2..fd4f4e1 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,9 @@
-# ejabberd-metrics
+## ejabberd-tools
+### error codes
+Lookup table for all custom error codes.
+The potential reasons are sorted by probability of being the root cause.
+
+| code | potential reason |
+| :---: | :---|
+| 17 | login credential mismatch, potential api permission problem |
diff --git a/api.py b/api.py
index ccd63e4..7807390 100644
--- a/api.py
+++ b/api.py
@@ -35,7 +35,11 @@ class EjabberdApi:
status = self.cmd('status', {})
# matches
- tmp = ver_str.findall(status)[0]
+ try:
+ tmp = ver_str.findall(status)[0]
+ # raise SystemExit code 17 if no status message is received
+ except TypeError:
+ raise SystemExit(17)
# return parsed version string
return version.parse(tmp)