Broad Exception Catch (ARCH2153)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Key python.logging.broad-except · Severity warning · Category logging
Catching except Exception (or bare except:) masks unrelated and programming errors alongside the failure you actually expected. This lets unexpected faults pass unnoticed.
Incorrect
Section titled “Incorrect”try: data = service.fetch(item_id)except Exception: data = []Correct
Section titled “Correct”try: data = service.fetch(item_id)except (TimeoutError, ConnectionError): data = []Catch only the specific exception types you anticipate; let the rest propagate.