From 4c6b176068bf89d0fa20fb9c680e2f231f60f11a Mon Sep 17 00:00:00 2001 From: Michael Choi Date: Fri, 14 Jun 2024 11:37:06 -0700 Subject: [PATCH] DEBUG: Add additional logging for authz errors (#539) * Add debug log for authz errors * no cover --- model-engine/model_engine_server/api/llms_v1.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/model-engine/model_engine_server/api/llms_v1.py b/model-engine/model_engine_server/api/llms_v1.py index 07a93d781..e9fb8a43d 100644 --- a/model-engine/model_engine_server/api/llms_v1.py +++ b/model-engine/model_engine_server/api/llms_v1.py @@ -237,6 +237,11 @@ async def get_model_endpoint( ) return await use_case.execute(user=auth, model_endpoint_name=model_endpoint_name) except (ObjectNotFoundException, ObjectNotAuthorizedException) as exc: + if isinstance(exc, ObjectNotAuthorizedException): # pragma: no cover + logger.info( + f"GET /llm/model-endpoints/{model_endpoint_name} for {auth} failed with authz error {exc.args}" + ) + raise HTTPException( status_code=404, detail=f"Model Endpoint {model_endpoint_name} was not found.",