From 69e4992151e61ce58d1b0223b74612f2d24ff3b1 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:03:54 -0600 Subject: [PATCH] maintain exception for non validation errors --- frigate/api/app.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/frigate/api/app.py b/frigate/api/app.py index abe09ce87..b1e798ead 100644 --- a/frigate/api/app.py +++ b/frigate/api/app.py @@ -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()