Skip to content

Commit

Permalink
Add catch for if we get non-200
Browse files Browse the repository at this point in the history
  • Loading branch information
LordRalex committed Oct 30, 2023
1 parent b126990 commit 2fa9a50
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ func getFileForMessageAttachment(channelId, messageId, filename string) (file *D
}
defer response.Body.Close()

if response.StatusCode != http.StatusOK {
err = errors.New("unexpected status code: " + response.Status)
return
}

var msg DiscordMessage
err = json.NewDecoder(response.Body).Decode(&msg)
if err != nil {
Expand Down

0 comments on commit 2fa9a50

Please sign in to comment.