Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

Making sure the response dispatched even in case of unhandled error (#333)

Rahul Johny00aa05347fbd
diff --git a/backend/account/authentication_controller.py b/backend/account/authentication_controller.py
index 446f63034..18822d21c 100644
--- a/backend/account/authentication_controller.py
+++ b/backend/account/authentication_controller.py
@@ -115,17 +115,22 @@ class AuthenticationController:
except Exception as ex:
#
self.user_logout(request)
+
+ response = Response(
+ status=status.HTTP_412_PRECONDITION_FAILED,
+ )
if hasattr(ex, "code") and ex.code in {
AuthorizationErrorCode.USF,
AuthorizationErrorCode.USR,
AuthorizationErrorCode.INE001,
AuthorizationErrorCode.INE002,
}: # type: ignore
- response = Response(
- status=status.HTTP_412_PRECONDITION_FAILED,
- data={"domain": ex.data.get("domain"), "code": ex.code},
- )
+ response.data = ({"domain": ex.data.get("domain"), "code": ex.code},)
return response
+ # Return in case even if missed unknown exception in
+ # self.auth_service.user_organizations(request)
+ return response
+
user: User = request.user
org_ids = {org.id for org in organizations}