From fe9fd2e460762f60c1887b07727e6dd6668970a8 Mon Sep 17 00:00:00 2001 From: Nick White Date: Mon, 28 Feb 2022 17:21:27 +0000 Subject: rescribe: Further improve getembeds error reporting and recognition --- cmd/rescribe/getembeds.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/rescribe/getembeds.go b/cmd/rescribe/getembeds.go index fb93d48..b9b59ae 100644 --- a/cmd/rescribe/getembeds.go +++ b/cmd/rescribe/getembeds.go @@ -34,6 +34,9 @@ func dl(url string) error { return fmt.Errorf("Error getting url %s: %v", url, err) } defer r.Body.Close() + if r.StatusCode != 200 { + return fmt.Errorf("Error getting url %s: got code %v", url, r.StatusCode) + } _, err = io.Copy(f, r.Body) if err != nil { @@ -105,7 +108,7 @@ func main() { } if !present(v.url, v.sum) { - fmt.Fprintf(os.Stderr, "Error: downloaded %s does not match expected checksum: %v\n", v.url, v.sum, err) + fmt.Fprintf(os.Stderr, "Error: downloaded %s does not match expected checksum\n", v.url) os.Exit(1) } } -- cgit v1.2.1-24-ge1ad