fix: handle missing anime directory gracefully on startup
This commit is contained in:
@@ -286,6 +286,11 @@ async def lifespan(_application: FastAPI):
|
||||
except (OSError, RuntimeError, ValueError) as e:
|
||||
logger.warning("Failed to initialize services: %s", e)
|
||||
# Continue startup - services can be initialized later
|
||||
except Exception as e: # includes HTTPException from get_anime_service
|
||||
logger.warning(
|
||||
"Failed to initialize services (anime directory may not exist): %s", e
|
||||
)
|
||||
# Continue startup - services can be configured/initialized later
|
||||
|
||||
logger.info("FastAPI application started successfully")
|
||||
logger.info("Server running on http://127.0.0.1:8000")
|
||||
|
||||
@@ -125,6 +125,14 @@ def get_series_app() -> SeriesApp:
|
||||
import tempfile
|
||||
anime_dir = tempfile.gettempdir()
|
||||
settings.anime_directory = anime_dir
|
||||
else:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
|
||||
detail=(
|
||||
f"Anime directory does not exist: {anime_dir}. "
|
||||
"Please configure a valid path."
|
||||
),
|
||||
)
|
||||
|
||||
_series_app = SeriesApp(anime_dir)
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user