Skip to content

Commit

Permalink
add exceptions docstrings & isort
Browse files Browse the repository at this point in the history
  • Loading branch information
vladNed committed Aug 29, 2024
1 parent 30e61c9 commit 71e3a4d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 10 additions & 0 deletions src/fastapi_endpoints/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,25 @@


class BaseOSException(Exception):
"""The base exception used to manage the message in a dynamic way"""

message: str

def __init__(self):
super().__init__(self.message)


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"
4 changes: 1 addition & 3 deletions src/fastapi_endpoints/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]


Expand Down

0 comments on commit 71e3a4d

Please sign in to comment.