From 8be1c5906541a91bef7cd9a122818a9a8005d355 Mon Sep 17 00:00:00 2001 From: Giovanni Harting <539@idlegandalf.com> Date: Sun, 23 Mar 2025 22:13:01 +0100 Subject: [PATCH] handle api return codes --- main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.go b/main.go index 2a7af6f..dc5b064 100644 --- a/main.go +++ b/main.go @@ -127,6 +127,12 @@ func ALHPBuildQueuePkgbase() ([]string, error) { } defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("ALHP api returned HTTP %d", resp.StatusCode) + } else if resp.StatusCode == http.StatusNotFound { + return nil, nil + } + bResp, err := io.ReadAll(resp.Body) if err != nil { return nil, err