diff --git a/pkgs/agit/agit.py b/pkgs/agit/agit.py index 4ecc6606b..570c3df33 100644 --- a/pkgs/agit/agit.py +++ b/pkgs/agit/agit.py @@ -179,7 +179,7 @@ def run_git_command(command: list) -> tuple[int, str, str]: try: result = subprocess.run(command, capture_output=True, text=True, check=False) return result.returncode, result.stdout.strip(), result.stderr.strip() - except Exception as e: + except (OSError, subprocess.SubprocessError) as e: return 1, "", str(e) diff --git a/pkgs/clan-cli/clan_lib/custom_logger/__init__.py b/pkgs/clan-cli/clan_lib/custom_logger/__init__.py index a48342bf4..f4efb439d 100644 --- a/pkgs/clan-cli/clan_lib/custom_logger/__init__.py +++ b/pkgs/clan-cli/clan_lib/custom_logger/__init__.py @@ -16,7 +16,7 @@ def _get_filepath(record: logging.LogRecord) -> Path: try: filepath = Path(record.pathname).resolve() filepath = Path("~", filepath.relative_to(Path.home())) - except Exception: + except ValueError: filepath = Path(record.pathname) return filepath @@ -117,7 +117,7 @@ def get_callers(start: int = 2, end: int = 2) -> list[str]: try: filepath = Path(frame_info.filename).resolve() filepath = Path("~", filepath.relative_to(Path.home())) - except Exception: + except ValueError: filepath = Path(frame_info.filename) ret = f"{filepath}:{frame_info.lineno}::{frame_info.function}"