diff options
author | Devaev Maxim <[email protected]> | 2019-12-09 02:26:48 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2019-12-09 02:26:48 +0300 |
commit | 3048fc79233f1ece909dee0f100e72a2f3f5a639 (patch) | |
tree | 834e0ab68541ecf0f58a4100f90ca0836b6f9bf5 /kvmd/plugins | |
parent | dd52a85cf6c21c5a7743acad152d8378f1ae0ef4 (diff) |
very common exceptions
Diffstat (limited to 'kvmd/plugins')
-rw-r--r-- | kvmd/plugins/atx/__init__.py | 7 | ||||
-rw-r--r-- | kvmd/plugins/msd/__init__.py | 15 | ||||
-rw-r--r-- | kvmd/plugins/msd/otg/__init__.py | 2 | ||||
-rw-r--r-- | kvmd/plugins/msd/relay.py | 2 |
4 files changed, 16 insertions, 10 deletions
diff --git a/kvmd/plugins/atx/__init__.py b/kvmd/plugins/atx/__init__.py index a593929e..b536ef87 100644 --- a/kvmd/plugins/atx/__init__.py +++ b/kvmd/plugins/atx/__init__.py @@ -24,6 +24,9 @@ from typing import Dict from typing import AsyncGenerator from typing import Type +from ...errors import OperationError +from ...errors import IsBusyError + from .. import BasePlugin from .. import get_plugin_class @@ -33,11 +36,11 @@ class AtxError(Exception): pass -class AtxOperationError(AtxError): +class AtxOperationError(OperationError, AtxError): pass -class AtxIsBusyError(AtxOperationError): +class AtxIsBusyError(IsBusyError, AtxError): def __init__(self) -> None: super().__init__("Performing another ATX operation, please try again later") diff --git a/kvmd/plugins/msd/__init__.py b/kvmd/plugins/msd/__init__.py index f43a40c2..95c0f0d0 100644 --- a/kvmd/plugins/msd/__init__.py +++ b/kvmd/plugins/msd/__init__.py @@ -27,6 +27,9 @@ from typing import Type from typing import AsyncGenerator from typing import Optional +from ...errors import OperationError +from ...errors import IsBusyError + from .. import BasePlugin from .. import get_plugin_class @@ -36,10 +39,15 @@ class MsdError(Exception): pass -class MsdOperationError(MsdError): +class MsdOperationError(OperationError, MsdError): pass +class MsdIsBusyError(IsBusyError, MsdError): + def __init__(self) -> None: + super().__init__("Performing another MSD operation, please try again later") + + class MsdOfflineError(MsdOperationError): def __init__(self) -> None: super().__init__("MSD is not found") @@ -70,11 +78,6 @@ class MsdImageExistsError(MsdOperationError): super().__init__("This image is already exists") -class MsdIsBusyError(MsdOperationError): - def __init__(self) -> None: - super().__init__("Performing another MSD operation, please try again later") - - class MsdMultiNotSupported(MsdOperationError): def __init__(self) -> None: super().__init__("This MSD does not support storing multiple images") diff --git a/kvmd/plugins/msd/otg/__init__.py b/kvmd/plugins/msd/otg/__init__.py index d8a5e9b7..41e1653f 100644 --- a/kvmd/plugins/msd/otg/__init__.py +++ b/kvmd/plugins/msd/otg/__init__.py @@ -48,13 +48,13 @@ from .... import aiotools from .... import aioregion from .. import MsdError +from .. import MsdIsBusyError from .. import MsdOfflineError from .. import MsdConnectedError from .. import MsdDisconnectedError from .. import MsdImageNotSelected from .. import MsdUnknownImageError from .. import MsdImageExistsError -from .. import MsdIsBusyError from .. import BaseMsd from . import fs diff --git a/kvmd/plugins/msd/relay.py b/kvmd/plugins/msd/relay.py index 1bec7d48..4e621cc2 100644 --- a/kvmd/plugins/msd/relay.py +++ b/kvmd/plugins/msd/relay.py @@ -53,10 +53,10 @@ from ...validators.os import valid_abs_path from ...validators.hw import valid_gpio_pin from . import MsdError +from . import MsdIsBusyError from . import MsdOfflineError from . import MsdConnectedError from . import MsdDisconnectedError -from . import MsdIsBusyError from . import MsdMultiNotSupported from . import MsdCdromNotSupported from . import BaseMsd |