From 53324e663a5f932f7004c4a17d0112b180e6fa9e Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Thu, 11 May 2023 21:59:44 +0000 Subject: [PATCH] Add ErrNotFound --- distro/debian/snapshot/mr/mr.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/distro/debian/snapshot/mr/mr.go b/distro/debian/snapshot/mr/mr.go index 5547c1f..c009f13 100644 --- a/distro/debian/snapshot/mr/mr.go +++ b/distro/debian/snapshot/mr/mr.go @@ -91,6 +91,8 @@ type Info struct { Result []Fileinfo `json:"result"` } +var ErrNotFound = errors.New("404 not found") + func getJson(query string, target interface{}) (err error) { flog := log.With().Str("url", query).Logger() @@ -111,8 +113,14 @@ func getJson(query string, target interface{}) (err error) { return } defer resp.Body.Close() + flog.Debug().Msgf("%s", resp.Status) + if resp.StatusCode == 404 { + err = ErrNotFound + return + } + if resp.StatusCode < 500 { break }