Skip to content

Commit

Permalink
Merge pull request #7 from NorbertRadvilovic/fix/handle-bad-requests-…
Browse files Browse the repository at this point in the history
…during-job-creation

Fix: handle bad requests during job creation
  • Loading branch information
UmanShahzad authored Feb 27, 2024
2 parents 3ea5ae3 + e49334c commit c4b88bb
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 c4b88bb

Please # to comment.