mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-30 20:56:39 +00:00
feat: add new errors processing
This commit is contained in:
parent
fbb2a67979
commit
cf3e6fe39e
|
@ -47,6 +47,7 @@ class PasswordResetLinkReturn(MutationReturnInterface):
|
||||||
|
|
||||||
|
|
||||||
def get_user_by_username(username: str) -> Optional[User]:
|
def get_user_by_username(username: str) -> Optional[User]:
|
||||||
|
# TODO: why isn't there TRY
|
||||||
user = actions_get_user_by_username(username=username)
|
user = actions_get_user_by_username(username=username)
|
||||||
if user is None:
|
if user is None:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -39,10 +39,12 @@ from selfprivacy_api.repositories.users.exceptions import (
|
||||||
UserNotFound,
|
UserNotFound,
|
||||||
SelfPrivacyAppIsOutdate,
|
SelfPrivacyAppIsOutdate,
|
||||||
)
|
)
|
||||||
from selfprivacy_api import PLEASE_UPDATE_APP_TEXT
|
from selfprivacy_api.repositories.users.exceptions_kanidm import (
|
||||||
from selfprivacy_api.repositories.users.kanidm_user_repository import (
|
|
||||||
KanidmDidNotReturnAdminPassword,
|
KanidmDidNotReturnAdminPassword,
|
||||||
|
KanidmReturnEmptyResponse,
|
||||||
|
KanidmReturnUnknownResponseType,
|
||||||
)
|
)
|
||||||
|
from selfprivacy_api import PLEASE_UPDATE_APP_TEXT
|
||||||
|
|
||||||
|
|
||||||
FAILED_TO_SETUP_PASSWORD_TEXT = "Failed to set a password for a user. The problem occurred due to an old version of the SelfPrivacy app."
|
FAILED_TO_SETUP_PASSWORD_TEXT = "Failed to set a password for a user. The problem occurred due to an old version of the SelfPrivacy app."
|
||||||
|
@ -98,6 +100,8 @@ class UsersMutations:
|
||||||
UsernameTooLong,
|
UsernameTooLong,
|
||||||
InvalidConfiguration,
|
InvalidConfiguration,
|
||||||
KanidmDidNotReturnAdminPassword,
|
KanidmDidNotReturnAdminPassword,
|
||||||
|
KanidmReturnUnknownResponseType,
|
||||||
|
KanidmReturnEmptyResponse,
|
||||||
) as error:
|
) as error:
|
||||||
return return_failed_mutation_return(
|
return return_failed_mutation_return(
|
||||||
message=error.get_error_message(),
|
message=error.get_error_message(),
|
||||||
|
@ -171,6 +175,8 @@ class UsersMutations:
|
||||||
PasswordIsEmpty,
|
PasswordIsEmpty,
|
||||||
SelfPrivacyAppIsOutdate,
|
SelfPrivacyAppIsOutdate,
|
||||||
KanidmDidNotReturnAdminPassword,
|
KanidmDidNotReturnAdminPassword,
|
||||||
|
KanidmReturnUnknownResponseType,
|
||||||
|
KanidmReturnEmptyResponse,
|
||||||
) as error:
|
) as error:
|
||||||
return return_failed_mutation_return(
|
return return_failed_mutation_return(
|
||||||
message=error.get_error_message(),
|
message=error.get_error_message(),
|
||||||
|
@ -260,6 +266,8 @@ class UsersMutations:
|
||||||
NoPasswordResetLinkFoundInResponse,
|
NoPasswordResetLinkFoundInResponse,
|
||||||
KanidmDidNotReturnAdminPassword,
|
KanidmDidNotReturnAdminPassword,
|
||||||
RootIsNotAvailableForModification,
|
RootIsNotAvailableForModification,
|
||||||
|
KanidmReturnUnknownResponseType,
|
||||||
|
KanidmReturnEmptyResponse,
|
||||||
) as error:
|
) as error:
|
||||||
return PasswordResetLinkReturn(
|
return PasswordResetLinkReturn(
|
||||||
success=False,
|
success=False,
|
||||||
|
|
Loading…
Reference in a new issue