Skip to content

Commit

Permalink
style: silence bugbear warning
Browse files Browse the repository at this point in the history
B904 Within an `except` clause, raise exceptions with
     `raise ... from err` or `raise ... from None` to
     distinguish them from errors in exception handling
  • Loading branch information
DimitriPapadopoulos authored and adrienverge committed Jan 8, 2024
1 parent 3e12694 commit 5969b4f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions yamllint/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def parse(self, raw_content):
try:
conf = yaml.safe_load(raw_content)
except Exception as e:
raise YamlLintConfigError(f'invalid config: {e}')
raise YamlLintConfigError(f'invalid config: {e}') from e

if not isinstance(conf, dict):
raise YamlLintConfigError('invalid config: not a dict')
Expand All @@ -95,7 +95,7 @@ def parse(self, raw_content):
try:
self.extend(base)
except Exception as e:
raise YamlLintConfigError(f'invalid config: {e}')
raise YamlLintConfigError(f'invalid config: {e}') from e

if 'ignore' in conf and 'ignore-from-file' in conf:
raise YamlLintConfigError(
Expand Down Expand Up @@ -143,7 +143,7 @@ def validate(self):
try:
rule = yamllint.rules.get(id)
except Exception as e:
raise YamlLintConfigError(f'invalid config: {e}')
raise YamlLintConfigError(f'invalid config: {e}') from e

self.rules[id] = validate_rule_conf(rule, self.rules[id])

Expand Down

0 comments on commit 5969b4f

Please sign in to comment.