Skip to content

Commit f48a216

Browse files
chore: rearrange exceptions code
This rearranges the exceptions code to be a bit less circular
1 parent 03aa947 commit f48a216

File tree

9 files changed

+31
-14
lines changed

9 files changed

+31
-14
lines changed

aprs_backend/aprs.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
from errbot.backends.base import Message
99
from errbot.backends.base import ONLINE
1010
from errbot.core import ErrBot
11-
from aprs_backend.exceptions.client.aprsis import APRSISConnnectError
12-
from aprs_backend.exceptions.packets.parser import PacketParseError
13-
from aprs_backend.exceptions import APRSBackendException
11+
from aprs_backend.exceptions import ProcessorError, PacketParseError, APRSISConnnectError
1412
from aprs_backend.packets.parser import parse, hash_packet
1513
from expiringdict import ExpiringDict
1614
from functools import cached_property
@@ -33,10 +31,6 @@
3331
)
3432

3533

36-
class ProcessorError(APRSBackendException):
37-
pass
38-
39-
4034
class APRSBackend(ErrBot):
4135
def __init__(self, config):
4236
log.debug("Initied")

aprs_backend/clients/aprsis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import asyncio
33
from functools import cached_property
44
import time
5-
from aprs_backend.exceptions.client.aprsis import (
5+
from aprs_backend.exceptions import (
66
APRSISClientError,
77
APRSISConnnectError,
88
APRSISPacketError,

aprs_backend/exceptions/__init__.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,19 @@
1-
class APRSBackendException(Exception):
2-
pass
1+
from aprs_backend.exceptions.processor import ProcessorError
2+
from aprs_backend.exceptions.client.aprsis import (
3+
APRSISClientError,
4+
APRSISConnnectError,
5+
APRSISDeadConnectionError,
6+
APRSISPacketDecodeError,
7+
APRSISPacketError,
8+
)
9+
from aprs_backend.exceptions.packets.parser import PacketParseError
10+
11+
__all__ = [
12+
"ProcessorError",
13+
"APRSISClientError",
14+
"APRSISConnnectError",
15+
"APRSISDeadConnectionError",
16+
"APRSISPacketDecodeError",
17+
"APRSISPacketError",
18+
"PacketParseError",
19+
]

aprs_backend/exceptions/base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class APRSBackendException(Exception):
2+
pass

aprs_backend/exceptions/client/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from aprs_backend.exceptions import APRSBackendException
1+
from aprs_backend.exceptions.base import APRSBackendException
22

33

44
class ClientError(APRSBackendException):

aprs_backend/exceptions/client/aprsis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from . import ClientError
1+
from aprs_backend.exceptions.client import ClientError
22

33

44
class APRSISClientError(ClientError):

aprs_backend/exceptions/packets/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from aprs_backend.exceptions import APRSBackendException
1+
from aprs_backend.exceptions.base import APRSBackendException
22

33

44
class PacketException(APRSBackendException):

aprs_backend/exceptions/processor.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from aprs_backend.exceptions.base import APRSBackendException
2+
3+
4+
class ProcessorError(APRSBackendException):
5+
pass

aprs_backend/utils/version.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)