Ir al contenido

Catch Of Control Flow Exception (ARCH2168)

Esta página aún no está disponible en tu idioma.

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.