mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-30 20:56:39 +00:00
fix: delete block try except in wrong place
This commit is contained in:
parent
62098493c4
commit
63ea78b1ef
|
@ -146,30 +146,29 @@ class KanidmUserRepository(AbstractUserRepository):
|
|||
timeout=0.8, # TODO: change timeout
|
||||
verify=False, # TODO: REMOVE THIS NOTHALAL!!!!!
|
||||
)
|
||||
|
||||
logger.info(str(response))
|
||||
response_data = response.json()
|
||||
|
||||
plugin_error = response_data.get("plugin", {})
|
||||
if plugin_error.get("attrunique") == "duplicate value detected":
|
||||
raise UserAlreadyExists # TODO only user ?
|
||||
|
||||
if response.status_code != 200:
|
||||
raise KanidmQueryError(
|
||||
f"Kanidm returned {response.status_code} unexpected HTTP status code. Endpoint: {full_endpoint}. Error: {response.text}."
|
||||
)
|
||||
|
||||
if (
|
||||
isinstance(response_data, dict)
|
||||
and response_data.get("data") is not None
|
||||
):
|
||||
return response_data
|
||||
else:
|
||||
raise KanidmReturnEmptyResponse
|
||||
|
||||
except Exception as error:
|
||||
raise KanidmQueryError(f"Kanidm request failed! Error: {str(error)}")
|
||||
|
||||
logger.info(str(response))
|
||||
response_data = response.json()
|
||||
|
||||
plugin_error = response_data.get("plugin", {})
|
||||
if plugin_error.get("attrunique") == "duplicate value detected":
|
||||
raise UserAlreadyExists # TODO only user ?
|
||||
|
||||
if response.status_code != 200:
|
||||
raise KanidmQueryError(
|
||||
f"Kanidm returned {response.status_code} unexpected HTTP status code. Endpoint: {full_endpoint}. Error: {response.text}."
|
||||
)
|
||||
|
||||
if (
|
||||
isinstance(response_data, dict)
|
||||
and response_data.get("data") is not None
|
||||
):
|
||||
return response_data
|
||||
else:
|
||||
raise KanidmReturnEmptyResponse
|
||||
|
||||
# nomatchingentries
|
||||
|
||||
@staticmethod
|
||||
|
|
Loading…
Reference in a new issue