From 3a29b3b869fa56343da366d2f4214aaaacc956cf Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Thu, 11 May 2023 12:54:54 +0000 Subject: [PATCH] Handle http errors --- distro/debian/snapshot/mr/mr.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/distro/debian/snapshot/mr/mr.go b/distro/debian/snapshot/mr/mr.go index dc9aaa8..5cd1790 100644 --- a/distro/debian/snapshot/mr/mr.go +++ b/distro/debian/snapshot/mr/mr.go @@ -77,6 +77,9 @@ func getJson(url string, target interface{}) (err error) { } defer resp.Body.Close() + if resp.StatusCode >= 400 { + return fmt.Errorf("%d", resp.StatusCode) + } return json.NewDecoder(resp.Body).Decode(target) }