Skip to content

Commit c1bbf6b

Browse files
committed
fix(error handling on verify):
1 parent 801a330 commit c1bbf6b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

agentic_security/routes/scan.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
UploadFile,
1111
)
1212
from fastapi.responses import StreamingResponse
13+
from loguru import logger
1314

1415
from ..core.app import get_stop_event, get_tools_inbox, set_current_run
1516
from ..dependencies import InMemorySecrets, get_in_memory_secrets
@@ -25,7 +26,12 @@ async def verify(
2526
info: LLMInfo, secrets: InMemorySecrets = Depends(get_in_memory_secrets)
2627
):
2728
spec = LLMSpec.from_string(info.spec)
28-
r = await spec.verify()
29+
try:
30+
r = await spec.verify()
31+
except Exception as e:
32+
logger.exception(e)
33+
raise HTTPException(status_code=400, detail=str(e))
34+
2935
if r.status_code >= 400:
3036
raise HTTPException(status_code=r.status_code, detail=r.text)
3137
return dict(

0 commit comments

Comments
 (0)