diff --git a/backend/app/api/routes/judge.py b/backend/app/api/routes/judge.py index bebedc9..d36b40a 100644 --- a/backend/app/api/routes/judge.py +++ b/backend/app/api/routes/judge.py @@ -64,6 +64,15 @@ async def fetch(rid: str, uid: str = "guest", session: Session = Depends(get_ses data = await svc.fetch(rid) except JudgeEngineError as e: raise HTTPException(404, str(e)) + except Exception as e: + import logging, traceback + logging.getLogger("fluent.judge").exception("judge fetch 未预期异常") + try: + with open("/tmp/fl_judge_err.log", "a") as f: + f.write(f"[{rid}] {type(e).__name__}: {e}\n{traceback.format_exc()}\n---\n") + except Exception: + pass + raise HTTPException(500, f"judge fetch 内部错误: {type(e).__name__}: {e}") # 判题结果回写消息 meta msg = MessageRepo(session).find_by_meta("rid", rid) if msg: