mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-03-20 21:39:44 +00:00
feat: add check response error text
This commit is contained in:
parent
a1f77918de
commit
b6a4758c9b
2 changed files with 4 additions and 2 deletions
selfprivacy_api
|
@ -35,8 +35,9 @@ class KanidmUserRepository(AbstractUserRepository):
|
|||
)
|
||||
|
||||
if response.status_code != 200:
|
||||
error_text = getattr(response, "text", "No response error was found...")
|
||||
raise KanidmQueryError(
|
||||
error=f"Kanidm returned unexpected HTTP status code. Error: {response.text}."
|
||||
error=f"Kanidm returned {response.status_code} unexpected HTTP status code. Error: {error_text}."
|
||||
)
|
||||
json = response.json()
|
||||
|
||||
|
|
|
@ -70,8 +70,9 @@ class MonitoringQueries:
|
|||
timeout=0.8,
|
||||
)
|
||||
if response.status_code != 200:
|
||||
error_text = getattr(response, "text", "No response error was found...")
|
||||
return MonitoringQueryError(
|
||||
error=f"Prometheus returned unexpected HTTP status code. Error: {response.text}. The query was {query}"
|
||||
error=f"Prometheus returned unexpected HTTP status code. Error: {error_text}. The query was {query}"
|
||||
)
|
||||
json = response.json()
|
||||
if result_type and json["data"]["resultType"] != result_type:
|
||||
|
|
Loading…
Add table
Reference in a new issue