Skip to content

Commit d793a2c

Browse files
authored
feat: improved error messages (#289)
1 parent 1cd0ebe commit d793a2c

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

pkg/controllers/account.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ func getAccountResource(c *gin.Context, id uuid.UUID) (models.Account, error) {
293293
},
294294
}).First(&account).Error
295295
if err != nil {
296-
httputil.ErrorHandler(c, err)
296+
httputil.NewError(c, http.StatusNotFound, errors.New("No account found for the specified ID"))
297297
return models.Account{}, err
298298
}
299299

pkg/controllers/allocation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ func getAllocationResource(c *gin.Context, id uuid.UUID) (models.Allocation, err
295295
},
296296
}).Error
297297
if err != nil {
298-
httputil.ErrorHandler(c, err)
298+
httputil.NewError(c, http.StatusNotFound, errors.New("No allocation found for the specified ID"))
299299
return models.Allocation{}, err
300300
}
301301

pkg/controllers/budget.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ func getBudgetResource(c *gin.Context, id uuid.UUID) (models.Budget, error) {
337337
},
338338
}).First(&budget).Error
339339
if err != nil {
340-
httputil.ErrorHandler(c, err)
340+
httputil.NewError(c, http.StatusNotFound, errors.New("No budget found for the specified ID"))
341341
return models.Budget{}, err
342342
}
343343

pkg/controllers/category.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ func getCategoryResource(c *gin.Context, id uuid.UUID) (models.Category, error)
290290
},
291291
}).First(&category).Error
292292
if err != nil {
293-
httputil.ErrorHandler(c, err)
293+
httputil.NewError(c, http.StatusNotFound, errors.New("No category found for the specified ID"))
294294
return models.Category{}, err
295295
}
296296

pkg/controllers/envelope.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ func getEnvelopeResource(c *gin.Context, id uuid.UUID) (models.Envelope, error)
326326
},
327327
}).First(&envelope).Error
328328
if err != nil {
329-
httputil.ErrorHandler(c, err)
329+
httputil.NewError(c, http.StatusNotFound, errors.New("No envelope found for the specified ID"))
330330
return models.Envelope{}, err
331331
}
332332

pkg/controllers/transaction.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ func getTransactionResource(c *gin.Context, id uuid.UUID) (models.Transaction, e
406406
},
407407
}).Error
408408
if err != nil {
409-
httputil.ErrorHandler(c, err)
409+
httputil.NewError(c, http.StatusNotFound, errors.New("No transaction found for the specified ID"))
410410
return models.Transaction{}, err
411411
}
412412

0 commit comments

Comments
 (0)