mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
(fix) allow gracefully handling DB connection errors on proxy (#7017)
* fix _handle_failed_db_connection_for_get_key_object * _handle_failed_db_connection_for_get_key_object * test_auth_not_connected_to_db
This commit is contained in:
parent
c32a8caa5e
commit
e499d39f9d
2 changed files with 36 additions and 2 deletions
|
@ -51,6 +51,7 @@ from litellm._service_logger import ServiceLogging
|
|||
from litellm.proxy._types import *
|
||||
from litellm.proxy.auth.auth_checks import (
|
||||
_cache_key_object,
|
||||
_handle_failed_db_connection_for_get_key_object,
|
||||
allowed_routes_check,
|
||||
can_key_call_model,
|
||||
common_checks,
|
||||
|
@ -802,7 +803,9 @@ async def user_api_key_auth( # noqa: PLR0915
|
|||
if (
|
||||
prisma_client is None
|
||||
): # if both master key + user key submitted, and user key != master key, and no db connected, raise an error
|
||||
raise Exception("No connected db.")
|
||||
return await _handle_failed_db_connection_for_get_key_object(
|
||||
e=Exception("No connected db.")
|
||||
)
|
||||
|
||||
## check for cache hit (In-Memory Cache)
|
||||
_user_role = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue