diff --git a/main.go b/main.go index 73b9184..9583e5d 100644 --- a/main.go +++ b/main.go @@ -180,6 +180,10 @@ retry_index: goto retry_index } } + if snapUrlCreds == nil { + panic(err) + } + client := http.Client{} u, err := url.Parse(snapUrlCreds.Url) if err != nil { @@ -261,6 +265,10 @@ func getSnapUrlCreds(fileName string) (*SnapUrlResponse, error) { return nil, err } + if res.StatusCode == http.StatusPaymentRequired { + return nil, errors.New(string(body)) + } + snapUrlResponse := SnapUrlResponse{} err = json.Unmarshal(body, &snapUrlResponse) if err != nil {