Improve strict validation errors with actionable fix hints
This commit is contained in:
parent
ad1af63fac
commit
c8739b6804
3 changed files with 162 additions and 39 deletions
|
|
@ -15,7 +15,7 @@ from pathlib import Path
|
|||
from typing import Any
|
||||
|
||||
from aiprocess import LlamaProcessor
|
||||
from config import Config, load, redacted_dict, validate
|
||||
from config import Config, ConfigValidationError, load, redacted_dict, validate
|
||||
from constants import DEFAULT_CONFIG_PATH, MODEL_PATH, RECORD_TIMEOUT_SEC, STT_LANGUAGE
|
||||
from desktop import get_desktop_adapter
|
||||
from diagnostics import run_diagnostics
|
||||
|
|
@ -449,6 +449,11 @@ def _run_command(args: argparse.Namespace) -> int:
|
|||
|
||||
try:
|
||||
cfg = load(args.config)
|
||||
except ConfigValidationError as exc:
|
||||
logging.error("startup failed: invalid config field '%s': %s", exc.field, exc.reason)
|
||||
if exc.example_fix:
|
||||
logging.error("example fix: %s", exc.example_fix)
|
||||
return 1
|
||||
except Exception as exc:
|
||||
logging.error("startup failed: %s", exc)
|
||||
return 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue