aboutsummaryrefslogtreecommitdiffhomepage
path: root/api/entry.go
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-08-25 10:04:38 -0700
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-08-25 10:04:58 -0700
commitb17e4e88f6f09a578be22d5a39cb47c8f14422ed (patch)
tree628f7a3740313006cea1a6c8c803bd2d5942dadb /api/entry.go
parentc327833314fafd4accb9bbfbaf01f0dbee7a9a10 (diff)
Expose real error messages for internal server API errors
Diffstat (limited to 'api/entry.go')
-rw-r--r--api/entry.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/api/entry.go b/api/entry.go
index cb9c043..37917c7 100644
--- a/api/entry.go
+++ b/api/entry.go
@@ -39,7 +39,7 @@ func (c *Controller) GetFeedEntry(w http.ResponseWriter, r *http.Request) {
entry, err := builder.GetEntry()
if err != nil {
- json.ServerError(w, errors.New("Unable to fetch this entry from the database"))
+ json.ServerError(w, err)
return
}
@@ -64,7 +64,7 @@ func (c *Controller) GetEntry(w http.ResponseWriter, r *http.Request) {
entry, err := builder.GetEntry()
if err != nil {
- json.ServerError(w, errors.New("Unable to fetch this entry from the database"))
+ json.ServerError(w, err)
return
}
@@ -122,13 +122,13 @@ func (c *Controller) GetFeedEntries(w http.ResponseWriter, r *http.Request) {
entries, err := builder.GetEntries()
if err != nil {
- json.ServerError(w, errors.New("Unable to fetch the list of entries"))
+ json.ServerError(w, err)
return
}
count, err := builder.CountEntries()
if err != nil {
- json.ServerError(w, errors.New("Unable to count the number of entries"))
+ json.ServerError(w, err)
return
}
@@ -174,13 +174,13 @@ func (c *Controller) GetEntries(w http.ResponseWriter, r *http.Request) {
entries, err := builder.GetEntries()
if err != nil {
- json.ServerError(w, errors.New("Unable to fetch the list of entries"))
+ json.ServerError(w, err)
return
}
count, err := builder.CountEntries()
if err != nil {
- json.ServerError(w, errors.New("Unable to count the number of entries"))
+ json.ServerError(w, err)
return
}
@@ -201,7 +201,7 @@ func (c *Controller) SetEntryStatus(w http.ResponseWriter, r *http.Request) {
}
if err := c.store.SetEntriesStatus(context.New(r).UserID(), entryIDs, status); err != nil {
- json.ServerError(w, errors.New("Unable to change entries status"))
+ json.ServerError(w, err)
return
}
@@ -217,7 +217,7 @@ func (c *Controller) ToggleBookmark(w http.ResponseWriter, r *http.Request) {
}
if err := c.store.ToggleBookmark(context.New(r).UserID(), entryID); err != nil {
- json.ServerError(w, errors.New("Unable to toggle bookmark value"))
+ json.ServerError(w, err)
return
}