mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
(feat) improve Prisma Auth Error
This commit is contained in:
parent
acbbccdef7
commit
ec68c3a29f
1 changed files with 8 additions and 1 deletions
|
@ -7,6 +7,7 @@ from litellm.proxy.hooks.parallel_request_limiter import MaxParallelRequestsHand
|
||||||
from litellm.proxy.hooks.max_budget_limiter import MaxBudgetLimiter
|
from litellm.proxy.hooks.max_budget_limiter import MaxBudgetLimiter
|
||||||
from litellm.integrations.custom_logger import CustomLogger
|
from litellm.integrations.custom_logger import CustomLogger
|
||||||
from litellm.proxy.db.base_client import CustomDB
|
from litellm.proxy.db.base_client import CustomDB
|
||||||
|
from litellm._logging import verbose_proxy_logger
|
||||||
from fastapi import HTTPException, status
|
from fastapi import HTTPException, status
|
||||||
import smtplib
|
import smtplib
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
|
@ -381,7 +382,7 @@ class PrismaClient:
|
||||||
# Token does not exist.
|
# Token does not exist.
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||||
detail="invalid user key",
|
detail="Authentication Error: invalid user key - token does not exist",
|
||||||
)
|
)
|
||||||
elif user_id is not None:
|
elif user_id is not None:
|
||||||
response = await self.db.litellm_usertable.find_unique( # type: ignore
|
response = await self.db.litellm_usertable.find_unique( # type: ignore
|
||||||
|
@ -559,7 +560,13 @@ class PrismaClient:
|
||||||
)
|
)
|
||||||
async def connect(self):
|
async def connect(self):
|
||||||
try:
|
try:
|
||||||
|
verbose_proxy_logger.debug(
|
||||||
|
"PrismaClient: connect() called Attempting to Connect to DB"
|
||||||
|
)
|
||||||
if self.db.is_connected() == False:
|
if self.db.is_connected() == False:
|
||||||
|
verbose_proxy_logger.debug(
|
||||||
|
"PrismaClient: DB not connected, Attempting to Connect to DB"
|
||||||
|
)
|
||||||
await self.db.connect()
|
await self.db.connect()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
asyncio.create_task(
|
asyncio.create_task(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue