Fixed errcheck linter complaints

This commit is contained in:
2019-06-05 15:45:54 +09:00
parent 190a85fe08
commit 940e949a30
15 changed files with 112 additions and 33 deletions

View File

@ -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

View File

@ -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()

View File

@ -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()
}