diff --git a/src/fastapi_endpoints/exceptions.py b/src/fastapi_endpoints/exceptions.py index d44767b..69e7261 100644 --- a/src/fastapi_endpoints/exceptions.py +++ b/src/fastapi_endpoints/exceptions.py @@ -4,6 +4,8 @@ class BaseOSException(Exception): + """The base exception used to manage the message in a dynamic way""" + message: str def __init__(self): @@ -11,8 +13,16 @@ def __init__(self): class InitializationError(BaseOSException): + """Error for any issue that comes when the routers are being fetched + and included in the app + """ + message = "Could not initialize routes as modules are not defined correctly" class RouterNotFound(BaseOSException): + """FastAPI APIRouter instance is not found in the router file + module. + """ + message = "Router module does not have an instance of APIRouter" diff --git a/src/fastapi_endpoints/router.py b/src/fastapi_endpoints/router.py index 445f3b1..e3d67b9 100644 --- a/src/fastapi_endpoints/router.py +++ b/src/fastapi_endpoints/router.py @@ -4,15 +4,13 @@ import importlib import pkgutil - -from typing import Set from types import ModuleType +from typing import Set import fastapi from . import exceptions, utils - Excluded = Set[ModuleType]