Skip to content

Commit

Permalink
Fix: handle bad requests during job creation
Browse files Browse the repository at this point in the history
  • Loading branch information
oxy-nr committed Feb 27, 2024
1 parent 3ea5ae3 commit e49334c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/async_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ func (c *Client) GetJobID(
if err != nil {
return "", fmt.Errorf("error reading resp body: %v", err)
}
resp.Body.Close()
defer resp.Body.Close()

if resp.StatusCode >= 300 {
return "", fmt.Errorf("error with status code %s: %s", resp.Status, respBody)
}

// Unmarshal into job.
job := &Job{}
Expand Down

0 comments on commit e49334c

Please # to comment.