Skip to content

Commit

Permalink
Add error handling for status code 404 in onCommandStatus function
Browse files Browse the repository at this point in the history
  • Loading branch information
vennekilde committed Apr 19, 2024
1 parent 42814bd commit b31fe86
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/interaction/interaction_cmd_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"net/http"
"strings"

"github.com/bwmarrin/discordgo"
Expand Down Expand Up @@ -75,7 +76,10 @@ func (c *StatusCmd) onCommandStatus(s *discordgo.Session, event *discordgo.Inter
if err != nil {
onError(s, event, err)
return
} else if resp.JSON200 == nil && resp.StatusCode() != 404 {
} else if resp.StatusCode() == http.StatusNotFound {
onError(s, event, errors.New("you are not verified"))
return
} else if resp.JSON200 == nil {
onError(s, event, errors.New("unexpected response from the server"))
return
}
Expand Down

0 comments on commit b31fe86

Please sign in to comment.