Skip to content

Commit

Permalink
feat: Add Wii Number to error message
Browse files Browse the repository at this point in the history
noahpistilli committed Dec 22, 2024
1 parent 5d4d1af commit 839d921
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions route.go
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@ package main

import (
"DemaeDominos/dominos"
"fmt"
"github.com/getsentry/sentry-go"
"net/http"
"strings"
@@ -58,7 +57,6 @@ func (r *RoutingGroup) MultipleRootNodes(action string, function func(*Response)

func (r *Route) Handle() http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
fmt.Println(req.URL.String())
// First check if it is an image route.
if strings.Contains(req.URL.Path, "itemimg") {
splitUrl := strings.Split(req.URL.Path, "/")
4 changes: 2 additions & 2 deletions utils.go
Original file line number Diff line number Diff line change
@@ -197,7 +197,7 @@ func PostDiscordWebhook(title, message, url string, color int) {
func (r *Response) ReportError(err error) {
if !errors.Is(err, dominos.InvalidCountry) && r.dominos != nil {
// Write the JSON Dominos sent us to the system.
_ = os.WriteFile(fmt.Sprintf("errors/%s_%s.json", r.request.URL.Path, r.GetHollywoodId()), r.dominos.GetResponse(), 0664)
_ = os.WriteFile(fmt.Sprintf("errors/%s_%s.json", r.request.URL.Path, r.request.Header.Get("X-WiiNo")), r.dominos.GetResponse(), 0664)
}

sentry.WithScope(func(s *sentry.Scope) {
@@ -207,7 +207,7 @@ func (r *Response) ReportError(err error) {

log.Printf("An error has occurred: %s", aurora.Red(err.Error()))

errorString := fmt.Sprintf("%s\nWii ID: %s", err.Error(), r.GetHollywoodId())
errorString := fmt.Sprintf("%s\nWii ID: %s\nWii Number: %s", err.Error(), r.GetHollywoodId(), r.request.Header.Get("X-WiiNo"))
PostDiscordWebhook("An error has occurred in Demae Domino's!", errorString, config.ErrorWebhook, 16711711)

// With the new patches I created, we can now send the error to the channel.

0 comments on commit 839d921

Please sign in to comment.