Add web auth, infinite-scroll, agent admission and review fixes across agent/server/web
This commit is contained in:
@@ -46,11 +46,12 @@ def install_error_handlers(app: FastAPI) -> None:
|
||||
|
||||
@app.exception_handler(StarletteHTTPException)
|
||||
async def _http(request: Request, exc: StarletteHTTPException):
|
||||
code = (
|
||||
"agent_blocked"
|
||||
if exc.status_code == 403 and exc.detail == "agent blocked"
|
||||
else _STATUS_TO_CODE.get(exc.status_code, "internal")
|
||||
)
|
||||
code: ErrorCode = _STATUS_TO_CODE.get(exc.status_code, "internal")
|
||||
if exc.status_code == 403:
|
||||
if exc.detail == "agent blocked":
|
||||
code = "agent_blocked"
|
||||
elif exc.detail == "agent not accepted":
|
||||
code = "agent_not_accepted"
|
||||
msg = exc.detail if isinstance(exc.detail, str) else code
|
||||
return error_response(request, exc.status_code, code, msg)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user