diff options
| author | Dennis Fink | 2026-11-13 20:03:49 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-13 20:03:49 +0100 |
| commit | 87117345ed6e99e5a070d919ac17139cba7b8fe4 (patch) | |
| tree | d7df5d45008dd2959194e2614b87333598b85198 /webmentions_ssg/tasks/sender.py | |
| parent | 2fbe1d383650cb31f3ef8d58c04e4d4095935833 (diff) | |
| download | webmentions-ssg-87117345ed6e99e5a070d919ac17139cba7b8fe4.tar.gz webmentions-ssg-87117345ed6e99e5a070d919ac17139cba7b8fe4.zip | |
fix(core): make network task failures explicit
Introduce a dedicated response-size error so callers only translate
expected limit violations instead of masking unrelated `ValueError`
exceptions.
Ensure failed sockets are always closed, remove dead discovery error
handling, and log unexpected sender failures with tracebacks before
recording them.
Diffstat (limited to '')
| -rw-r--r-- | webmentions_ssg/tasks/sender.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/webmentions_ssg/tasks/sender.py b/webmentions_ssg/tasks/sender.py index db99476..cd6c64a 100644 --- a/webmentions_ssg/tasks/sender.py +++ b/webmentions_ssg/tasks/sender.py @@ -210,10 +210,8 @@ def send_webmention_task(webmention_uuid: uuid.UUID) -> None: httpx.InvalidURL, httpx.UnsupportedProtocol, httpx.LocalProtocolError, - ValueError, - UnicodeError, ) as exc: - # Invalid URLs and local protocol errors cannot improve with retries. + # Known permanent failures cannot improve with retries. outcome = SentWebmentionStatus.FAILED reason = str(exc) or type(exc).__name__ except (TemporarySenderError, AddressResolutionError, httpx.RequestError) as exc: @@ -221,6 +219,14 @@ def send_webmention_task(webmention_uuid: uuid.UUID) -> None: reason = str(exc) or "Webmention request failed" terminal = attempt >= max_attempts temporary_failure = True + except Exception as exc: + # Unexpected errors must not disappear into a generic permanent-failure + # handler without a traceback (including programming ValueErrors). + current_app.logger.exception( + "Unexpected error sending SentWebmention %s", webmention_uuid + ) + outcome = SentWebmentionStatus.FAILED + reason = str(exc) or type(exc).__name__ # A scanner may have reopened or superseded the revision during I/O. # Refresh only once, and persist one outcome atomically with its metadata. |
