fix(tradein/security): 404 IMV-адрес — warning без traceback, не exception-шум (#2234)
All checks were successful
CI Trade-In / changes (pull_request) Successful in 13s
CI / changes (pull_request) Successful in 14s
CI Trade-In / frontend-checks (pull_request) Has been skipped
CI / backend-tests (pull_request) Has been skipped
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Has been skipped
CI Trade-In / backend-tests (pull_request) Successful in 2m25s
All checks were successful
CI Trade-In / changes (pull_request) Successful in 13s
CI / changes (pull_request) Successful in 14s
CI Trade-In / frontend-checks (pull_request) Has been skipped
CI / backend-tests (pull_request) Has been skipped
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Has been skipped
CI Trade-In / backend-tests (pull_request) Successful in 2m25s
This commit is contained in:
parent
c65a73ca9a
commit
efa0bafa18
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