From 294d8572068ba96d54492685ae8bdb450de762cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Tronel?= Date: Sat, 29 Aug 2026 15:30:47 +0200 Subject: [PATCH] Put all exceptions in their dedicated module. --- src/tscut/exceptions.py | 23 +++++++++++++++++++++++ src/tscut/tools/discovery.py | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 src/tscut/exceptions.py diff --git a/src/tscut/exceptions.py b/src/tscut/exceptions.py new file mode 100644 index 0000000..0aa19a0 --- /dev/null +++ b/src/tscut/exceptions.py @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2026 Frédéric Tronel + + +from typing import IO + +from typeguard import typechecked + +class TSCutError(Exception): + """Base exception for tscut.""" + + +class MissingToolError(TSCutError): + """Raised when a required external tool is unavailable.""" + + +class ExternalToolError(TSCutError): + """Raised when an external tool fails.""" + + +class InvalidMediaError(TSCutError): + """Raised when input media cannot be processed.""" diff --git a/src/tscut/tools/discovery.py b/src/tscut/tools/discovery.py index b56a721..671f0ee 100644 --- a/src/tscut/tools/discovery.py +++ b/src/tscut/tools/discovery.py @@ -8,10 +8,10 @@ from shutil import which from typeguard import typechecked +from tscut.exceptions import MissingToolError + logger = logging.getLogger(__name__) -class MissingToolError(Exception): - pass @typechecked def check_required_tools() -> tuple[bool,dict[str,str]]: