diff --git a/internal/async_helpers.go b/internal/async_helpers.go index faf0ec5..1f72075 100644 --- a/internal/async_helpers.go +++ b/internal/async_helpers.go @@ -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 creating job: %s", respBody) + } // Unmarshal into job. job := &Job{}