Fix error handling in get_components and add

missing condition in StoreService
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-11-16 13:01:35 -03:00
commit 966c4dad0b
2 changed files with 2 additions and 2 deletions

View file

@ -4,7 +4,6 @@ from uuid import UUID
from fastapi import APIRouter, Depends, HTTPException, Query
from httpx import HTTPStatusError
from langflow.services.auth import utils as auth_utils
from langflow.services.database.models.user.user import User
from langflow.services.deps import get_settings_service, get_store_service
@ -173,7 +172,7 @@ async def get_components(
elif isinstance(exc, ValueError):
if "Check your API key" in str(exc):
raise HTTPException(status_code=401, detail=str(exc))
elif "filter by likes" in str(exc):
elif "filter by likes" in str(exc) or "filter your components" in str(exc):
raise HTTPException(status_code=400, detail=str(exc))
raise HTTPException(status_code=403, detail=str(exc))

View file

@ -171,6 +171,7 @@ class StoreService(Service):
filter_conditions.append(liked_filter)
elif liked and not store_api_Key:
raise ValueError("You must provide an API key to filter by likes")
if filter_by_user and store_api_Key:
user_data = user_data_var.get()
if not user_data: