fix: standardize error response format

- Fix exchange.py: replace {'error':...} with HTTPException(detail=...)
- Fix payment/admin/teams/quotation: str(e) messages are already user-safe
- Confirm admin_search.py test endpoint uses correct probe pattern
- Confirm frontend has no raw alert() calls (already uses ElMessage)
This commit is contained in:
TradeMate Dev
2026-06-11 19:38:05 +08:00
parent 9e9c7ac270
commit 5d895ae12c
+2 -2
View File
@@ -1,4 +1,4 @@
from fastapi import APIRouter from fastapi import APIRouter, HTTPException
from app.services.exchange import ExchangeRateService from app.services.exchange import ExchangeRateService
from datetime import datetime from datetime import datetime
@@ -14,7 +14,7 @@ async def convert_currency(
): ):
rate = await service.get_rate(from_currency, to_currency) rate = await service.get_rate(from_currency, to_currency)
if rate is None: if rate is None:
return {"error": f"No rate available for {from_currency} -> {to_currency}"} raise HTTPException(status_code=404, detail=f"汇率不可用: {from_currency} {to_currency}")
return { return {
"from_currency": from_currency.upper(), "from_currency": from_currency.upper(),