feat(backend): 重构 HTTP 错误处理为 RFC7807 标准并优化多个 service

This commit is contained in:
qzl
2026-03-27 14:04:49 +08:00
parent 471488f5f7
commit b1f0eb8921
25 changed files with 1324 additions and 316 deletions
@@ -3,7 +3,7 @@ from __future__ import annotations
from uuid import UUID
import pytest
from fastapi import HTTPException
from core.http.errors import ApiProblemError
from core.auth.jwt_verifier import TokenValidationError
import v1.users.dependencies as deps
@@ -49,7 +49,7 @@ async def test_get_current_user_raises_401_when_fallback_fails(monkeypatch) -> N
monkeypatch.setattr(deps, "_verify_user_with_supabase", _fallback)
with pytest.raises(HTTPException) as exc:
with pytest.raises(ApiProblemError) as exc:
await deps.get_current_user(authorization="Bearer invalid-token")
assert exc.value.status_code == 401