refactor(backend): clean up jail service, add error handling service
- Extract jail status/processing to helper functions - Add error_handling.py service for centralized error handling - Update config.py with validation and defaults - Update .env.example with all config options - Remove obsolete Tasks.md, add Service-Development.md - Minor fixes across routers and services Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -433,6 +433,7 @@ async def preview_blocklist(
|
||||
source_id: int,
|
||||
http_session: HttpSessionDep,
|
||||
blocklist_ctx: BlocklistServiceContextDep,
|
||||
settings: SettingsDep,
|
||||
_auth: AuthDep,
|
||||
) -> PreviewResponse:
|
||||
"""Download and preview a sample of a blocklist source.
|
||||
@@ -455,7 +456,9 @@ async def preview_blocklist(
|
||||
raise BlocklistSourceNotFoundError(source_id)
|
||||
|
||||
try:
|
||||
domain_result = await blocklist_service.preview_source(source.url, http_session)
|
||||
domain_result = await blocklist_service.preview_source(
|
||||
source.url, http_session, sample_lines=settings.blocklist_preview_max_lines
|
||||
)
|
||||
return blocklist_mappers.map_domain_preview_result_to_response(domain_result)
|
||||
except ValueError as exc:
|
||||
raise BadRequestError(f"Could not fetch blocklist: {exc}") from exc
|
||||
|
||||
Reference in New Issue
Block a user