move exceptions out of folders and sources [LET-4631] (#5444)

This commit is contained in:
Ari Webb
2025-10-15 10:01:13 -07:00
committed by Caren Thomas
parent dad7254b1b
commit 967cc3decf
8 changed files with 71 additions and 89 deletions

View File

@@ -33,6 +33,7 @@ from letta.errors import (
LettaMCPTimeoutError,
LettaToolCreateError,
LettaToolNameConflictError,
LettaUnsupportedFileUploadError,
LettaUserNotFoundError,
LLMAuthenticationError,
LLMError,
@@ -244,6 +245,7 @@ def create_application() -> "FastAPI":
_error_handler_408 = partial(error_handler_with_code, code=408)
_error_handler_409 = partial(error_handler_with_code, code=409)
_error_handler_410 = partial(error_handler_with_code, code=410)
_error_handler_415 = partial(error_handler_with_code, code=415)
_error_handler_422 = partial(error_handler_with_code, code=422)
_error_handler_500 = partial(error_handler_with_code, code=500)
_error_handler_503 = partial(error_handler_with_code, code=503)
@@ -273,6 +275,9 @@ def create_application() -> "FastAPI":
app.add_exception_handler(UniqueConstraintViolationError, _error_handler_409)
app.add_exception_handler(IntegrityError, _error_handler_409)
# 415 Unsupported Media Type errors
app.add_exception_handler(LettaUnsupportedFileUploadError, _error_handler_415)
# 422 Validation errors
app.add_exception_handler(ValidationError, _error_handler_422)