diff --git a/cmd/download.go b/cmd/download.go index 9ef4988..6047757 100644 --- a/cmd/download.go +++ b/cmd/download.go @@ -15,6 +15,7 @@ package cmd import ( "fmt" + "net/http" "os" "path" "regexp" @@ -57,6 +58,9 @@ Loop: case <-t.C: callback(resp) case <-resp.Done: + if resp.HTTPResponse.StatusCode != http.StatusOK { + return fmt.Errorf("error downloading file: %d", resp.HTTPResponse.StatusCode) + } callback(resp) break Loop }