mirror of
https://github.com/Octops/quake-kube.git
synced 2026-04-05 17:20:33 +00:00
Add context to content-server assets download error
This commit is contained in:
@ -14,6 +14,7 @@ import (
|
||||
"strings"
|
||||
|
||||
httputil "github.com/criticalstack/quake-kube/internal/util/net/http"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func CopyAssets(u *url.URL, dir string) error {
|
||||
@ -60,7 +61,7 @@ func getManifest(url string) ([]*File, error) {
|
||||
|
||||
files := make([]*File, 0)
|
||||
if err := json.Unmarshal(data, &files); err != nil {
|
||||
return nil, err
|
||||
return nil, errors.Wrapf(err, "cannot unmarshal %s/assets/manifest.json", url)
|
||||
}
|
||||
return files, nil
|
||||
}
|
||||
|
||||
@ -18,6 +18,10 @@ func GetBody(url string) ([]byte, error) {
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return nil, errors.Errorf("cannot get url %q: %v", url, http.StatusText(resp.StatusCode))
|
||||
}
|
||||
|
||||
return ioutil.ReadAll(resp.Body)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user