From 8b2e188c51844da2c15910c795128879db95eb7a Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sat, 13 Jan 2024 10:59:15 +0100 Subject: [PATCH] style: silence flake8-blind-except warnings BLE001 Do not catch blind exception: `Exception` --- yamllint/config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yamllint/config.py b/yamllint/config.py index 9ce62549..060d31e5 100644 --- a/yamllint/config.py +++ b/yamllint/config.py @@ -75,7 +75,7 @@ def extend(self, base_config): def parse(self, raw_content): try: conf = yaml.safe_load(raw_content) - except Exception as e: + except yaml.YAMLError as e: raise YamlLintConfigError(f'invalid config: {e}') from e if not isinstance(conf, dict): @@ -94,7 +94,7 @@ def parse(self, raw_content): base = YamlLintConfig(file=path) try: self.extend(base) - except Exception as e: + except AssertionError as e: raise YamlLintConfigError(f'invalid config: {e}') from e if 'ignore' in conf and 'ignore-from-file' in conf: @@ -142,7 +142,7 @@ def validate(self): for id in self.rules: try: rule = yamllint.rules.get(id) - except Exception as e: + except ValueError as e: raise YamlLintConfigError(f'invalid config: {e}') from e self.rules[id] = validate_rule_conf(rule, self.rules[id])