fix(config): handle critical config errors

Propagate critical init and entrypoint failures to halt startup
and log them as fatal during config loading
This commit is contained in:
yusing
2026-02-05 22:56:09 +08:00
parent 211e4ad465
commit fc540ea419
3 changed files with 31 additions and 3 deletions

View File

@@ -60,6 +60,16 @@ func Load() error {
cfgWatcher = watcher.NewConfigFileWatcher(common.ConfigFileName)
initErr := state.InitFromFile(common.ConfigPath)
if initErr != nil {
// if error is critical, notify and return it without starting providers
var criticalErr CriticalError
if errors.As(initErr, &criticalErr) {
logNotifyError("init", criticalErr.err)
return criticalErr.err
}
}
// disable pool logging temporary since we already have pretty logging
routes.HTTP.DisableLog(true)
routes.Stream.DisableLog(true)