From d4dada174af8340a21bbceb4721c79d6ab8dec05 Mon Sep 17 00:00:00 2001 From: dettlaff Date: Tue, 10 Dec 2024 20:02:06 +0400 Subject: [PATCH] fix: try to except kanidm errors --- selfprivacy_api/repositories/users/kanidm_user_repository.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/selfprivacy_api/repositories/users/kanidm_user_repository.py b/selfprivacy_api/repositories/users/kanidm_user_repository.py index 498648f..7a76872 100644 --- a/selfprivacy_api/repositories/users/kanidm_user_repository.py +++ b/selfprivacy_api/repositories/users/kanidm_user_repository.py @@ -155,7 +155,7 @@ class KanidmUserRepository(AbstractUserRepository): response = response.json() - if response.get("plugin"): + if response["plugin"]: if response["plugin"].get("attrunique") == "duplicate value detected": raise UserAlreadyExists # TODO only user? @@ -165,6 +165,7 @@ class KanidmUserRepository(AbstractUserRepository): raise KanidmQueryError(f"Kanidm request failed! Error: {str(error)}") # {"plugin": {"attrunique": "duplicate value detected"}} + # nomatchingentries @staticmethod def create_user(