From 04cb7bf4b52bb28fc2e4a429692565e732f098c4 Mon Sep 17 00:00:00 2001 From: GareArc Date: Thu, 26 Dec 2024 05:00:22 -0500 Subject: [PATCH] fix: add account register error message --- api/controllers/console/auth/oauth.py | 2 +- api/services/account_service.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/api/controllers/console/auth/oauth.py b/api/controllers/console/auth/oauth.py index 829af2b94bb01b..2a08362c6d62a9 100644 --- a/api/controllers/console/auth/oauth.py +++ b/api/controllers/console/auth/oauth.py @@ -100,7 +100,7 @@ def get(self, provider: str): "?message=Workspace not found, please contact system admin to invite you to join in a workspace." ) except AccountRegisterError as e: - return redirect(f"{dify_config.CONSOLE_WEB_URL}/signin?message={str(e)}") + return redirect(f"{dify_config.CONSOLE_WEB_URL}/signin?message={e.description}") # Check account status if account.status == AccountStatus.BANNED.value: diff --git a/api/services/account_service.py b/api/services/account_service.py index 08af88e63f7df2..35bd0ed58e22ec 100644 --- a/api/services/account_service.py +++ b/api/services/account_service.py @@ -884,6 +884,10 @@ def register( db.session.commit() except WorkSpaceNotAllowedCreateError: db.session.rollback() + except AccountRegisterError as are: + db.session.rollback() + logging.exception("Register failed") + raise are except Exception as e: db.session.rollback() logging.exception("Register failed")