refactor(store): add error returns to all Store interface methods
Every Store method now returns an error. Callers handle errors gracefully — TUI logs to event log, server returns HTTP 500, monitor engine logs and retries. All rows.Scan() errors are now checked in sqlstore.go instead of silently appending corrupt data. - GetSites, GetAllAlerts, GetAllUsers return ([]T, error) - GetAlert returns (AlertConfig, error) instead of (AlertConfig, bool) - AddSite, UpdateSite, DeleteSite, etc. all return error - SaveCheck, LoadAllHistory, ExportData return error - ~25 caller sites updated across tui, server, monitor, main
This commit is contained in:
@@ -185,7 +185,12 @@ func Start(cfg ServerConfig) {
|
||||
http.Error(w, "Unauthorized: UPKEEP_CLUSTER_SECRET required", 401)
|
||||
return
|
||||
}
|
||||
data := store.Get().ExportData()
|
||||
data, err := store.Get().ExportData()
|
||||
if err != nil {
|
||||
log.Printf("Export failed: %v", err)
|
||||
http.Error(w, "Export failed", 500)
|
||||
return
|
||||
}
|
||||
json.NewEncoder(w).Encode(data)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user