mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-23 00:41:40 +00:00
fix(proxy): return 503 when database connections are exhausted
This commit is contained in:
parent
bd753aecf3
commit
2c0905919f
2 changed files with 14 additions and 0 deletions
|
|
@ -195,6 +195,11 @@ class PrismaDBExceptionHandler:
|
|||
"""
|
||||
import asyncio
|
||||
|
||||
from prisma.errors import DataError
|
||||
|
||||
if isinstance(e, DataError) and e.code == "P2037":
|
||||
return True
|
||||
|
||||
if PrismaDBExceptionHandler.is_database_connection_error(e):
|
||||
return True
|
||||
if PrismaDBExceptionHandler.is_database_transport_error(e):
|
||||
|
|
|
|||
|
|
@ -122,6 +122,15 @@ async def test_handle_authentication_error_data_layer_errors_do_not_fall_back(
|
|||
OSError("network is unreachable"),
|
||||
HTTPClientClosedError(),
|
||||
PrismaError("can't reach database server"),
|
||||
DataError(
|
||||
data={
|
||||
"user_facing_error": {
|
||||
"error_code": "P2037",
|
||||
"message": "Too many database connections opened: FATAL: sorry, too many clients already",
|
||||
"meta": {"database_error": "FATAL: sorry, too many clients already"},
|
||||
}
|
||||
}
|
||||
),
|
||||
RawQueryError(
|
||||
data={
|
||||
"user_facing_error": {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue