handle api return codes
This commit is contained in:
6
main.go
6
main.go
@@ -127,6 +127,12 @@ func ALHPBuildQueuePkgbase() ([]string, error) {
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return nil, fmt.Errorf("ALHP api returned HTTP %d", resp.StatusCode)
|
||||
} else if resp.StatusCode == http.StatusNotFound {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
bResp, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user