Skip to content

Commit

Permalink
Return a 500 error when item.remove fails (#4832)
Browse files Browse the repository at this point in the history
* Return a 500 error when `item.remove` fails

Currently, errors from `item.remove` are not handled at all in the callback. This gives an empty 200 back to the frontend, which will do nothing with this response (no visual feedback on the error).
We should return an actual error. All suggestions on how to return this error Keystone style are welcome.

* directly send the `err` to `apiError`
  • Loading branch information
laurenskling authored and autoboxer committed Dec 19, 2018
1 parent 8455fd5 commit 027339d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion admin/server/api/list/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ module.exports = function (req, res) {
deletedIds.push(item.id);
next();
});
}, function () {
}, function (err) {
if (err) return res.apiError(err);
return res.json({
success: true,
ids: deletedIds,
Expand Down

0 comments on commit 027339d

Please sign in to comment.