README.md proposes this handling function:
app.use((err, req, res, next) => {
if (err.message === 'access denied') {
res.status(403);
res.json({ error: err.message });
}
next(err);
});
But what is the purpose of calling next(err) after the error is handled?
I based my handling function on that and I was having problems with it. Express was throwing the error again when I called next(error). After I removed it, the code worked just fine. I believe this might be the cause for the problem some people are reporting in #33.