Fixed errcheck linter complaints
This commit is contained in:
@ -35,7 +35,12 @@ func Start(ctx aero.Context) error {
|
||||
return ctx.Error(http.StatusBadRequest, "Job is currently running!")
|
||||
}
|
||||
|
||||
job.Start()
|
||||
err := job.Start()
|
||||
|
||||
if err != nil {
|
||||
return ctx.Error(http.StatusInternalServerError, "Job could not be started!", err)
|
||||
}
|
||||
|
||||
jobLogs = append(jobLogs, user.Nick+" started "+job.Name+" job ("+arn.DateTimeUTC()+").")
|
||||
|
||||
return nil
|
||||
|
@ -45,14 +45,20 @@ func BuyItem(ctx aero.Context) error {
|
||||
return ctx.Error(http.StatusBadRequest, "Not enough gems. You need to charge up your balance before you can buy this item.")
|
||||
}
|
||||
|
||||
user.Balance -= totalPrice
|
||||
user.Save()
|
||||
|
||||
// Add item to user inventory
|
||||
inventory := user.Inventory()
|
||||
inventory.AddItem(itemID, uint(quantity))
|
||||
err = inventory.AddItem(itemID, uint(quantity))
|
||||
|
||||
if err != nil {
|
||||
return ctx.Error(http.StatusBadRequest, err)
|
||||
}
|
||||
|
||||
inventory.Save()
|
||||
|
||||
// Deduct balance
|
||||
user.Balance -= totalPrice
|
||||
user.Save()
|
||||
|
||||
// Save purchase
|
||||
purchase := arn.NewPurchase(user.ID, itemID, quantity, int(item.Price), "gem")
|
||||
purchase.Save()
|
||||
|
@ -23,6 +23,5 @@ func Download(ctx aero.Context) error {
|
||||
return ctx.Error(http.StatusNotFound, "Track not found", err)
|
||||
}
|
||||
|
||||
track.Download()
|
||||
return nil
|
||||
return track.Download()
|
||||
}
|
||||
|
Reference in New Issue
Block a user