Fix unauthorized exception handling
This commit is contained in:
parent
6531d36fd5
commit
34fe9a7bbb
1 changed files with 2 additions and 2 deletions
|
|
@ -4,7 +4,6 @@ from uuid import UUID
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, HTTPException, Query
|
from fastapi import APIRouter, Depends, HTTPException, Query
|
||||||
from httpx import HTTPStatusError
|
from httpx import HTTPStatusError
|
||||||
|
|
||||||
from langflow.services.auth import utils as auth_utils
|
from langflow.services.auth import utils as auth_utils
|
||||||
from langflow.services.database.models.user.user import User
|
from langflow.services.database.models.user.user import User
|
||||||
from langflow.services.deps import get_settings_service, get_store_service
|
from langflow.services.deps import get_settings_service, get_store_service
|
||||||
|
|
@ -198,5 +197,6 @@ async def like_component(
|
||||||
if exc.response.status_code == 403:
|
if exc.response.status_code == 403:
|
||||||
raise HTTPException(status_code=403, detail="Forbidden")
|
raise HTTPException(status_code=403, detail="Forbidden")
|
||||||
elif exc.response.status_code == 401:
|
elif exc.response.status_code == 401:
|
||||||
raise HTTPException(status_code=401, detail="Unauthorized")
|
# 403 to avoid falling into interceptor 401
|
||||||
|
raise HTTPException(status_code=403, detail="Unauthorized")
|
||||||
raise HTTPException(status_code=500, detail=str(exc))
|
raise HTTPException(status_code=500, detail=str(exc))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue