err express code example
Example 1: how to handle all error of all router in express
const handleErrorAsync = func => (req, res, next) => {
func(req, res, next).catch((error) => next(error));
};
Example 2: error handler
function handlerError(request, response){
response.status(500).send('opps');
}
.catch(handlerError);