From 1cde63dd64ee03cb52319c6415c795147bf65099 Mon Sep 17 00:00:00 2001 From: Daniel Hiltgen Date: Tue, 27 Feb 2024 09:17:04 -0800 Subject: [PATCH] Log unexpected server errors checking for update This should unmask some failure modes that likely show up in app logs as unmarshal errors --- app/lifecycle/updater.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/lifecycle/updater.go b/app/lifecycle/updater.go index e0d23299..f26e32af 100644 --- a/app/lifecycle/updater.go +++ b/app/lifecycle/updater.go @@ -86,6 +86,11 @@ func IsNewReleaseAvailable(ctx context.Context) (bool, UpdateResponse) { if err != nil { slog.Warn(fmt.Sprintf("failed to read body response: %s", err)) } + + if resp.StatusCode != 200 { + slog.Info(fmt.Sprintf("check update error %d - %.96s", resp.StatusCode, string(body))) + return false, updateResp + } err = json.Unmarshal(body, &updateResp) if err != nil { slog.Warn(fmt.Sprintf("malformed response checking for update: %s", err))