I want to show the error text I throw in the orange error popup. I talk about extended routes.
Actual behavior
When I’ve got an error in a collection (Users here), Forest produce this error text : Users deletion failed: unexpected error. instead the text error I pass in the next.
For instance, in your documentation, it’s possible to throw a specific error text, but it never appears in the orange error popup:
router.delete('/companies/:recordId', permissionMiddlewareCreator.delete(), (request, response, next) => {
if (request.params.recordId === 82) {
next(new Error('This record is protected, you cannot remove it.'));
return;
}
const recordRemover = new RecordRemover(companies);
recordRemover.remove(request.params.recordId)
.then(() => response.status(204).send())
.catch(next);
});
@Sliman_Medini your example is working beacause you use the route router.delete("/user/:recordId"..., but try with the route router.delete("/user", permissionMiddlewareCreator.delete() without the recordId in the route.