fix(tradein/security): admin.py — generic detail + error-id вместо сырого текста исключений (#2234) #2261
1 changed files with 7 additions and 2 deletions
|
|
@ -688,8 +688,13 @@ async def scrape_avito_imv(
|
|||
has_loggia=has_loggia,
|
||||
)
|
||||
except IMVAddressNotFoundError as e:
|
||||
raise _safe_http_error(
|
||||
404, "IMV address not found", f"avito-imv: address not found for {address}"
|
||||
# Ожидаемое клиентское условие (адрес не в базе Avito), НЕ сбой — logger.warning
|
||||
# без traceback, чтобы не шуметь exception-событиями в GlitchTip. Адрес — в лог,
|
||||
# не в HTTP-ответ.
|
||||
error_id = uuid4().hex[:8]
|
||||
logger.warning("avito-imv: address not found for %s (error-id=%s)", address, error_id)
|
||||
raise HTTPException(
|
||||
status_code=404, detail=f"IMV address not found (error-id: {error_id})"
|
||||
) from e
|
||||
except Exception as e:
|
||||
raise _safe_http_error(502, "fetch failed", f"avito-imv: fetch failed for {address}") from e
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue