Felix Beltran

Thank you for your comment.

It depends on the error you want to handle (500, 4xx, etc). 
In my case, I use node.js for my API and I reform the response object before I send it.

For example, if you want to handle a 500 error, you can send the following response:
res.status(500).json({error: {title: ‘An error occurred’, message: err.message});

I hope this will help :)