mirror of
https://github.com/kuhyx/steam-backlog-enforcer.git
synced 2026-11-19 21:14:22 +01:00
Every except Exception in the daemon, ctl socket, web server and job runner now catches FAIL_SAFE_ERRORS (OSError, ValueError, TypeError, LookupError, RuntimeError, SubprocessError). A bug outside it is loud: the ctl thread dies with its slot freed, http.server reports it, a job writes its failed result and re-raises. Todo: 9b9342ba Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
1.0 KiB
Python
31 lines
1.0 KiB
Python
"""The exceptions a fail-safe handler absorbs; anything else propagates.
|
|
|
|
No handler in the live enforcer catches ``Exception`` (kuhy's call, todo
|
|
9b9342ba). A handler that must outlive a failing input or op catches this
|
|
tuple instead:
|
|
|
|
* ``OSError``: files, sockets, ``/proc``, signals (incl. timeouts, a peer
|
|
that hung up, ``ProcessLookupError``);
|
|
* ``ValueError``: malformed data, incl. ``json`` and Unicode decode errors;
|
|
* ``TypeError`` and ``LookupError``: a payload of the wrong shape;
|
|
* ``RuntimeError``: incl. ``RecursionError``, which leisure_watch has raised;
|
|
* ``subprocess.SubprocessError``: a helper that failed or timed out.
|
|
|
|
A programming bug outside it (``AttributeError``, ``NameError``, ...) is loud:
|
|
it reaches the thread's or the process's own error reporting.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import subprocess
|
|
from typing import Final
|
|
|
|
FAIL_SAFE_ERRORS: Final[tuple[type[Exception], ...]] = (
|
|
OSError,
|
|
ValueError,
|
|
TypeError,
|
|
LookupError,
|
|
RuntimeError,
|
|
subprocess.SubprocessError,
|
|
)
|