mirror of
https://github.com/miniflux/v2.git
synced 2025-08-06 17:41:00 +00:00
Expose real error messages for internal server API errors
This commit is contained in:
parent
c327833314
commit
b17e4e88f6
6 changed files with 25 additions and 26 deletions
|
@ -36,7 +36,7 @@ func (c *Controller) CreateCategory(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
err = c.store.CreateCategory(category)
|
||||
if err != nil {
|
||||
json.ServerError(w, errors.New("Unable to create this category"))
|
||||
json.ServerError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ func (c *Controller) UpdateCategory(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
err = c.store.UpdateCategory(category)
|
||||
if err != nil {
|
||||
json.ServerError(w, errors.New("Unable to update this category"))
|
||||
json.ServerError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ func (c *Controller) GetCategories(w http.ResponseWriter, r *http.Request) {
|
|||
ctx := context.New(r)
|
||||
categories, err := c.store.Categories(ctx.UserID())
|
||||
if err != nil {
|
||||
json.ServerError(w, errors.New("Unable to fetch categories"))
|
||||
json.ServerError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ func (c *Controller) RemoveCategory(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
if err := c.store.RemoveCategory(userID, categoryID); err != nil {
|
||||
json.ServerError(w, errors.New("Unable to remove this category"))
|
||||
json.ServerError(w, err)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue