mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
also return error
This commit is contained in:
parent
3a827bbd6f
commit
c22e4d73bd
1 changed files with 4 additions and 4 deletions
|
@ -8,11 +8,11 @@ import (
|
|||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func ApiCall(uri string) string {
|
||||
func ApiCall(uri string) (string, error) {
|
||||
resp, err := http.Get(fmt.Sprintf("https://customapi.aidenwallis.co.uk/%s", uri))
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return "Something went wrong FeelsBadMan"
|
||||
return "Something went wrong FeelsBadMan", err
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
@ -20,7 +20,7 @@ func ApiCall(uri string) string {
|
|||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return "Something went wrong FeelsBadMan"
|
||||
return "Something went wrong FeelsBadMan", err
|
||||
}
|
||||
return string(body)
|
||||
return string(body), nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue