Skip to content

Commit

Permalink
fix: Nil error if order failed
Browse files Browse the repository at this point in the history
  • Loading branch information
noahpistilli committed Dec 24, 2024
1 parent a44680c commit 218907c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions basket.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,16 +408,16 @@ func orderDone(r *Response) {
}

// If the error does fail we should alert the user and allow for the basket to be cleared.
didError := false
err = r.dominos.PlaceOrder(user)
if err != nil {
orderErr := r.dominos.PlaceOrder(user)
if orderErr != nil {
PostDiscordWebhook(
"Performing error failed.",
fmt.Sprintf("The order was placed by user id %s", r.GetHollywoodId()),
config.OrderWebhook,
65311,
)
didError = true
r.ReportError(err)
return
}

currentTime := time.Now().Format("200602011504")
Expand All @@ -432,7 +432,7 @@ func orderDone(r *Response) {

// Remove the order data from the database
_, err = pool.Exec(context.Background(), ClearBasket, "", "", "[]", r.GetHollywoodId())
if err != nil || didError {
if err != nil {
r.ReportError(err)
return
}
Expand Down

0 comments on commit 218907c

Please sign in to comment.