Skip to content

fix: replace bare except clauses with specific exception types - #723

Open
koteshyelamati wants to merge 5 commits into
kellyjonbrazil:masterfrom
koteshyelamati:master
Open

fix: replace bare except clauses with specific exception types#723
koteshyelamati wants to merge 5 commits into
kellyjonbrazil:masterfrom
koteshyelamati:master

Conversation

@koteshyelamati

Copy link
Copy Markdown

Summary

Replace bare except: clauses with specific exception types across 5 files.

Changes

File Line Old New Reason
jc/parsers/proc_driver_rtc.py 131 except: except ValueError: int(val) raises ValueError on bad input
jc/parsers/xrandr.py 371 except: except IndexError: line[i] raises IndexError past end of string
jc/parsers/xrandr.py 506 except: except Exception: _Line.categorize() may raise various exceptions
tests/test_yaml.py 11 except: except ImportError: import fallback
tests/test_jc_cli.py 9, 15 except: except ImportError: import fallbacks
tests/test_xml.py 9 except: except ImportError: import fallback
tests/test_xml.py 17 except: except Exception: version parse error

Why

Bare except: silently swallows KeyboardInterrupt, SystemExit, and GeneratorExit — signals that should propagate. Each fix uses the most specific type that covers the actual exception raised.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant