return errnoauth on 401-403 for fe

master v0.4.0
Bel LaPointe 2022-01-27 15:28:00 -07:00
parent 9427e85202
commit 0ab4b795bd
1 changed files with 13 additions and 1 deletions

View File

@ -134,7 +134,19 @@ func (fe FastExact) newRequest(state config.State) (*http.Request, error) {
} }
func (fe FastExact) doRequest(req *http.Request) (*http.Response, error) { func (fe FastExact) doRequest(req *http.Request) (*http.Response, error) {
return do(req) resp, err := do(req)
if err != nil {
return nil, err
}
if resp.StatusCode != http.StatusOK {
b, _ := ioutil.ReadAll(resp.Body)
logtr.Errorf("fastExact bad status: %d: %s", resp.StatusCode, b)
if resp.StatusCode > 400 && resp.StatusCode < 404 {
return nil, ErrNoAuth
}
return nil, fmt.Errorf("bad status from FastExact: %d: %s", resp.StatusCode, b)
}
return resp, nil
} }
func (fe FastExact) parse(resp *http.Response) ([]Job, error) { func (fe FastExact) parse(resp *http.Response) ([]Job, error) {