From 6ceb735acd7728a6db1c59b0a4ad46e7e0ea9147 Mon Sep 17 00:00:00 2001 From: Joerg Herbel Date: Wed, 15 May 2024 08:45:56 +0200 Subject: [PATCH] Small improvements to error handling --- checkmk_weblate_syncer/po.py | 2 +- checkmk_weblate_syncer/pot.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/checkmk_weblate_syncer/po.py b/checkmk_weblate_syncer/po.py index 5a72dc2..644ecc5 100644 --- a/checkmk_weblate_syncer/po.py +++ b/checkmk_weblate_syncer/po.py @@ -91,7 +91,7 @@ def _process_po_file_pair( return _Failure( error_message=f"Found formatting errors: {e.stderr}", path=locale_po_file ) - except Exception as e: # pylint: disable=broad-except + except IOError as e: return _Failure(error_message=str(e), path=locale_po_file) LOGGER.info("Removing unwanted lines from %s", locale_po_file) diff --git a/checkmk_weblate_syncer/pot.py b/checkmk_weblate_syncer/pot.py index 74abdc6..bf7da02 100644 --- a/checkmk_weblate_syncer/pot.py +++ b/checkmk_weblate_syncer/pot.py @@ -25,7 +25,7 @@ def run(config: PotModeConfig) -> int: e.stderr, ) raise e - except Exception as e: + except IOError as e: LOGGER.error("Generating pot file failed") raise e @@ -33,7 +33,7 @@ def run(config: PotModeConfig) -> int: path_pot_file = config.locale_repository.path / config.locale_pot_path try: path_pot_file.write_text(completed_pot_generation_process.stdout) - except Exception as e: + except IOError as e: LOGGER.error("Writing pot file failed") raise e