Return an error if the file doesn't exists
This commit is contained in:
parent
d4ee546a91
commit
2d7a7f67e8
1 changed files with 3 additions and 1 deletions
|
@ -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
|
||||
|
|
Reference in a new issue