mirror of
https://github.com/gurnec/removeddit.git
synced 2026-03-11 08:54:27 +00:00
More error checking
This commit is contained in:
parent
9a7b59a548
commit
1d2f0c4806
1 changed files with 5 additions and 1 deletions
|
|
@ -179,7 +179,11 @@ func getAPIToken() (string, error) {
|
|||
return "", errors.New("Coulnd't get API token from Reddit")
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
body, _ := ioutil.ReadAll(resp.Body)
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return "", errors.New("Coulnd't get API token from Reddit, timeout error")
|
||||
}
|
||||
|
||||
var r tokenResponse
|
||||
json.Unmarshal(body, &r)
|
||||
return r.AccessToken, nil
|
||||
|
|
|
|||
Loading…
Reference in a new issue