If you do next() then it will skip to the next middleware, which would in this case would be the 404 (page not found) page:
|
router.use(error.client); |
|
router.use(error.server); |
But since there is an error with the API, I think the error page should be the 500 server error page instead. A trick that we learnt from @jamiecoe was to use next(err) instead of next() to skip to the 500 middleware/page instead. 👍
crypt-os/src/controllers/coin.js
Line 24 in 8fdbafc
If you do
next()then it will skip to the next middleware, which would in this case would be the 404 (page not found) page:crypt-os/src/controllers/index.js
Lines 14 to 15 in 8fdbafc
But since there is an error with the API, I think the error page should be the 500 server error page instead. A trick that we learnt from @jamiecoe was to use
next(err)instead ofnext()to skip to the 500 middleware/page instead. 👍