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:
@@ -1,4 +1,4 @@
|
||||
from fastapi import APIRouter
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from app.services.exchange import ExchangeRateService
|
||||
from datetime import datetime
|
||||
|
||||
@@ -14,7 +14,7 @@ async def convert_currency(
|
||||
):
|
||||
rate = await service.get_rate(from_currency, to_currency)
|
||||
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 {
|
||||
"from_currency": from_currency.upper(),
|
||||
|
||||
Reference in New Issue
Block a user