From 96bdc247da770db1b1f6fc2809cf8e3717ccc034 Mon Sep 17 00:00:00 2001 From: David Caravello <119438707+dcaravel@users.noreply.github.com> Date: Mon, 15 Dec 2025 13:03:21 -0600 Subject: [PATCH] handle bad status code --- croncheck/nvd.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/croncheck/nvd.go b/croncheck/nvd.go index 47e2799..8ac67fd 100644 --- a/croncheck/nvd.go +++ b/croncheck/nvd.go @@ -51,6 +51,10 @@ func validateNVDCVEIsEvaluated(cve string) (bool, error) { return false, err } + if resp.StatusCode != http.StatusOK { + return false, fmt.Errorf("NVD API returned status %d (%s): %q", resp.StatusCode, http.StatusText(resp.StatusCode), string(data)) + } + var result schema.CVEAPIJSON20 if err := json.Unmarshal(data, &result); err != nil { return false, fmt.Errorf("unmarshalling NVD response result: %w", err)