From 8701ab80c0d4873d6fe18bbc4ebd008ac37642fa Mon Sep 17 00:00:00 2001 From: Neda Moeini <neda.moeini@GA0479-NMOEINI.local> Date: Thu, 19 Oct 2023 13:21:05 +0200 Subject: [PATCH] Moved exceptions to a general exception module. --- gso/services/netbox_client.py | 14 +------------- gso/utils/exceptions.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 13 deletions(-) create mode 100644 gso/utils/exceptions.py diff --git a/gso/services/netbox_client.py b/gso/services/netbox_client.py index 28774d24..02f5313a 100644 --- a/gso/services/netbox_client.py +++ b/gso/services/netbox_client.py @@ -8,21 +8,9 @@ from pynetbox.models.dcim import Devices, DeviceTypes, Interfaces from gso.products.product_types.router import Router from gso.settings import load_oss_params from gso.utils.device_info import DEFAULT_SITE, FEASIBLE_IP_TRUNK_LAG_RANGE, ROUTER_ROLE, TierInfo +from gso.utils.exceptions import NotFoundError, WorkflowStateError -class NotFoundError(Exception): - """Exception raised for not found search.""" - - pass - - -class WorkflowStateError(Exception): - """Exception raised on problems during workflow.""" - - pass - - -# Define device models class Manufacturer(pydantic.BaseModel): """Defines the manufacturer of a device.""" diff --git a/gso/utils/exceptions.py b/gso/utils/exceptions.py new file mode 100644 index 00000000..21c127e8 --- /dev/null +++ b/gso/utils/exceptions.py @@ -0,0 +1,10 @@ +class NotFoundError(Exception): + """Exception raised for not found search.""" + + pass + + +class WorkflowStateError(Exception): + """Exception raised on problems during workflow.""" + + pass -- GitLab