fix: replace bare except with Exception in check-docker.py#11069
fix: replace bare except with Exception in check-docker.py#11069harshadkhetpal wants to merge 1 commit intolablup:mainfrom
Conversation
Bare except clauses catch BaseException, including KeyboardInterrupt and SystemExit, which is almost never intended. This change uses the more specific `except Exception:` to avoid swallowing system-level exceptions (PEP 8 E722).
|
|
1 similar comment
|
|
| try: | ||
| r.raise_for_status() | ||
| except: | ||
| except BaseException: |
There was a problem hiding this comment.
except BaseException is effectively the same as a bare except:. it catches everything including KeyboardInterrupt, SystemExit, and GeneratorExit.
Since the intent here is to handle HTTP/request errors, this should be except Exception: instead, so that system-level signals can still propagate normally.
Summary
Replaces bare
except:clauses withexcept Exception:inscripts/check-docker.py.Motivation
Bare
except:catchesBaseException, which includesKeyboardInterruptandSystemExit. This can mask critical signals like Ctrl-C and make debugging harder. PEP 8 flags this as E722.Change
Testing
No behavior change for normal error paths — only behavior change is that
KeyboardInterrupt/SystemExitnow propagate as intended.