refactor: Remove unused HTTPException imports from routers
After removing all try/except blocks that used HTTPException for domain exception conversion, these imports are no longer needed in the routers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -2,16 +2,9 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Annotated
|
from typing import Annotated
|
||||||
|
|
||||||
from fastapi import APIRouter, HTTPException, Path, Query, Request, status
|
from fastapi import APIRouter, Path, Query, Request, status
|
||||||
|
|
||||||
from app.dependencies import AuthDep, Fail2BanConfigDirDep, Fail2BanSocketDep
|
from app.dependencies import AuthDep, Fail2BanConfigDirDep, Fail2BanSocketDep
|
||||||
from app.exceptions import (
|
|
||||||
ActionAlreadyExistsError,
|
|
||||||
ActionNameError,
|
|
||||||
ActionNotFoundError,
|
|
||||||
ActionReadonlyError,
|
|
||||||
ConfigWriteError,
|
|
||||||
)
|
|
||||||
from app.models.config import (
|
from app.models.config import (
|
||||||
ActionConfig,
|
ActionConfig,
|
||||||
ActionCreateRequest,
|
ActionCreateRequest,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ Manual ban and unban operations and the active-bans overview:
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from fastapi import APIRouter, HTTPException, Request, status
|
from fastapi import APIRouter, Request, status
|
||||||
|
|
||||||
from app.dependencies import (
|
from app.dependencies import (
|
||||||
AuthDep,
|
AuthDep,
|
||||||
@@ -19,11 +19,9 @@ from app.dependencies import (
|
|||||||
GeoBatchLookupDep,
|
GeoBatchLookupDep,
|
||||||
HttpSessionDep,
|
HttpSessionDep,
|
||||||
)
|
)
|
||||||
from app.exceptions import JailNotFoundError, JailOperationError
|
|
||||||
from app.models.ban import ActiveBanListResponse, BanRequest, UnbanAllResponse, UnbanRequest
|
from app.models.ban import ActiveBanListResponse, BanRequest, UnbanAllResponse, UnbanRequest
|
||||||
from app.models.jail import JailCommandResponse
|
from app.models.jail import JailCommandResponse
|
||||||
from app.services import ban_service, jail_service
|
from app.services import ban_service, jail_service
|
||||||
from app.exceptions import Fail2BanConnectionError
|
|
||||||
|
|
||||||
router: APIRouter = APIRouter(prefix="/api/bans", tags=["Bans"])
|
router: APIRouter = APIRouter(prefix="/api/bans", tags=["Bans"])
|
||||||
|
|
||||||
|
|||||||
@@ -2,17 +2,9 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Annotated
|
from typing import Annotated
|
||||||
|
|
||||||
from fastapi import APIRouter, HTTPException, Path, Query, Request, status
|
from fastapi import APIRouter, Path, Query, Request, status
|
||||||
|
|
||||||
from app.dependencies import AuthDep, Fail2BanConfigDirDep, Fail2BanSocketDep
|
from app.dependencies import AuthDep, Fail2BanConfigDirDep, Fail2BanSocketDep
|
||||||
from app.exceptions import (
|
|
||||||
ConfigWriteError,
|
|
||||||
FilterAlreadyExistsError,
|
|
||||||
FilterInvalidRegexError,
|
|
||||||
FilterNameError,
|
|
||||||
FilterNotFoundError,
|
|
||||||
FilterReadonlyError,
|
|
||||||
)
|
|
||||||
from app.models.config import (
|
from app.models.config import (
|
||||||
FilterConfig,
|
FilterConfig,
|
||||||
FilterCreateRequest,
|
FilterCreateRequest,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import Annotated
|
from typing import Annotated
|
||||||
|
|
||||||
from fastapi import APIRouter, HTTPException, Path, Query, Request, status
|
from fastapi import APIRouter, Path, Query, Request, status
|
||||||
|
|
||||||
from app.dependencies import (
|
from app.dependencies import (
|
||||||
AppDep,
|
AppDep,
|
||||||
@@ -12,21 +12,6 @@ from app.dependencies import (
|
|||||||
Fail2BanStartCommandDep,
|
Fail2BanStartCommandDep,
|
||||||
PendingRecoveryDep,
|
PendingRecoveryDep,
|
||||||
)
|
)
|
||||||
from app.exceptions import (
|
|
||||||
ActionNameError,
|
|
||||||
ActionNotFoundError,
|
|
||||||
ConfigOperationError,
|
|
||||||
ConfigValidationError,
|
|
||||||
ConfigWriteError,
|
|
||||||
Fail2BanConnectionError,
|
|
||||||
FilterNameError,
|
|
||||||
FilterNotFoundError,
|
|
||||||
JailAlreadyActiveError,
|
|
||||||
JailAlreadyInactiveError,
|
|
||||||
JailNameError,
|
|
||||||
JailNotFoundError,
|
|
||||||
JailNotFoundInConfigError,
|
|
||||||
)
|
|
||||||
from app.models.config import (
|
from app.models.config import (
|
||||||
ActivateJailRequest,
|
ActivateJailRequest,
|
||||||
AddLogPathRequest,
|
AddLogPathRequest,
|
||||||
|
|||||||
@@ -10,12 +10,11 @@ to flush log files.
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from fastapi import APIRouter, HTTPException, Request, status
|
from fastapi import APIRouter, Request, status
|
||||||
|
|
||||||
from app.dependencies import AuthDep, Fail2BanSocketDep
|
from app.dependencies import AuthDep, Fail2BanSocketDep
|
||||||
from app.models.server import ServerSettingsResponse, ServerSettingsUpdate
|
from app.models.server import ServerSettingsResponse, ServerSettingsUpdate
|
||||||
from app.services import server_service
|
from app.services import server_service
|
||||||
from app.exceptions import ServerOperationError, Fail2BanConnectionError
|
|
||||||
|
|
||||||
router: APIRouter = APIRouter(prefix="/api/server", tags=["Server"])
|
router: APIRouter = APIRouter(prefix="/api/server", tags=["Server"])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user