Skip to content

Commit

Permalink
Testing new error handling with HTTP status codes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Fearne committed Aug 11, 2022
1 parent bd9c506 commit b06e1d7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/storage/fs/cback/utilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,21 @@ func (fs *cback) getRequest(userName, url string, reqType string) (io.ReadCloser
return nil, err
}

if resp.StatusCode == 404 {
err = errors.New("not found")
return nil, err
}

if resp.StatusCode == 500 {
err = errors.New("invalid query")
return nil, err
}

if resp.StatusCode == 403 {
err = errors.New("no permissions to get backup")
return nil, err
}

return resp.Body, nil
}

Expand Down

0 comments on commit b06e1d7

Please sign in to comment.