From 89739301dc4bff855bf7c458517d15cf5316df2d Mon Sep 17 00:00:00 2001 From: r3v5 Date: Thu, 4 Sep 2025 14:16:22 +0100 Subject: [PATCH] refactor(server): remove hardcoded 409 and 404 status codes in server.py using httpx constants --- llama_stack/core/server/server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llama_stack/core/server/server.py b/llama_stack/core/server/server.py index d6dfc3435..b247a610d 100644 --- a/llama_stack/core/server/server.py +++ b/llama_stack/core/server/server.py @@ -132,9 +132,9 @@ def translate_exception(exc: Exception) -> HTTPException | RequestValidationErro }, ) elif isinstance(exc, ConflictError): - return HTTPException(status_code=409, detail=str(exc)) + return HTTPException(status_code=httpx.codes.CONFLICT, detail=str(exc)) elif isinstance(exc, ResourceNotFoundError): - return HTTPException(status_code=404, detail=str(exc)) + return HTTPException(status_code=httpx.codes.NOT_FOUND, detail=str(exc)) elif isinstance(exc, ValueError): return HTTPException(status_code=httpx.codes.BAD_REQUEST, detail=f"Invalid value: {str(exc)}") elif isinstance(exc, BadRequestError):