maintain exception for non validation errors

This commit is contained in:
Josh Hawkins 2024-12-18 13:03:54 -06:00
parent 2dbc1e5d17
commit 69e4992151

View File

@ -16,6 +16,7 @@ from fastapi import APIRouter, Body, Path, Request, Response
from fastapi.encoders import jsonable_encoder
from fastapi.params import Depends
from fastapi.responses import JSONResponse, PlainTextResponse
from markupsafe import escape
from peewee import operator
from pydantic import ValidationError
@ -247,6 +248,17 @@ def config_save(save_option: str, body: Any = Body(media_type="text/plain")):
status_code=400,
)
except Exception:
return JSONResponse(
content=(
{
"success": False,
"message": f"\nYour configuration is invalid.\nSee the official documentation at docs.frigate.video.\n\n{escape(str(traceback.format_exc()))}",
}
),
status_code=400,
)
# Save the config to file
try:
config_file = find_config_file()