1
0

Add ErrNotFound

This commit is contained in:
dump_stack() 2023-05-11 21:59:44 +00:00
parent d4fbec39a6
commit 53324e663a
Signed by: dump_stack
GPG Key ID: BE44DA8C062D87DC

View File

@ -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
}