Return an error if the file doesn't exists

This commit is contained in:
nemunaire 2016-01-21 20:41:54 +01:00
parent d4ee546a91
commit 2d7a7f67e8

View File

@ -55,7 +55,9 @@ func getCloudFile(pathname string) ([]byte, error) {
return nil, err
} else {
defer resp.Body.Close()
if body, err := ioutil.ReadAll(resp.Body); err != nil {
if resp.StatusCode != http.StatusOK {
return nil, errors.New(resp.Status)
} else if body, err := ioutil.ReadAll(resp.Body); err != nil {
return nil, err
} else {
return body, nil