Zum Inhalt springen

Catch Of Control Flow Exception (ARCH2168)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Key python.logging.catch-control-flow · Severity warning · Category logging

Catching framework/runtime exceptions like KeyboardInterrupt or SystemExit that should propagate breaks cancellation and shutdown behavior. These exceptions let the application stop cleanly.

try:
run_worker()
except BaseException:
logger.error("Worker stopped")
try:
run_worker()
except Exception:
logger.exception("Worker error")

Catch Exception rather than BaseException; let cancellation and shutdown exceptions propagate.