Skip to content

Commit

Permalink
Fail the generator if getting the input fails
Browse files Browse the repository at this point in the history
  • Loading branch information
nlowe committed Dec 13, 2019
1 parent 57e567a commit cb1cd85
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gen/problem.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ func getInput(day int) ([]byte, error) {
}
defer mustClose(resp.Body)

if resp.StatusCode != http.StatusOK {
body, _ := ioutil.ReadAll(resp.Body)
return nil, fmt.Errorf("unexpected status code %s: %s", resp.Status, body)
}

body, err := ioutil.ReadAll(resp.Body)
return body, err
}
Expand Down

0 comments on commit cb1cd85

Please sign in to comment.