Scaffold backend (FastAPI/uv) and frontend (SvelteKit/bun)
Backend: FastAPI app with health check, AppError hierarchy, stderr logging via LOG_LEVEL, ruff+pyright(strict) config, pytest passing. Frontend: SvelteKit (TS) with prettier, eslint, vitest (unit + component), adapter-node for self-hosted deployment on Zeus. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
06df9df339
commit
e5b4f54cd8
33 changed files with 517 additions and 4 deletions
41
backend/app/errors.py
Normal file
41
backend/app/errors.py
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
"""Base exception hierarchy for the Sagaphone backend.
|
||||
|
||||
Errors propagate normally; only the API edge (see main.py's exception
|
||||
handler) catches them and translates them into an HTTP response.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
class AppError(Exception):
|
||||
"""Base class for all application errors."""
|
||||
|
||||
status_code: int = 500
|
||||
|
||||
def __init__(self, message: str) -> None:
|
||||
super().__init__(message)
|
||||
self.message = message
|
||||
|
||||
|
||||
class NotFoundError(AppError):
|
||||
"""Requested resource does not exist."""
|
||||
|
||||
status_code = 404
|
||||
|
||||
|
||||
class ConfigError(AppError):
|
||||
"""Missing or invalid configuration (e.g. secrets.toml)."""
|
||||
|
||||
status_code = 500
|
||||
|
||||
|
||||
class NarrationError(AppError):
|
||||
"""The narration (Haiku) call failed or returned something unusable."""
|
||||
|
||||
status_code = 502
|
||||
|
||||
|
||||
class TTSError(AppError):
|
||||
"""The TTS (Piper) synthesis step failed."""
|
||||
|
||||
status_code = 502
|
||||
Loading…
Add table
Add a link
Reference in a new issue