(req, res, next)
| 2 | |
| 3 | // IMPORTANT: Leave this function as `async` even though it doesn't need to be! |
| 4 | export default async function triggerError(req, res, next) { |
| 5 | // IMPORTANT: |
| 6 | // Do NOT wrap this method's contents in the usual `try-catch+next(error)` |
| 7 | // pattern used on async middleware! This is an intentional omission! |
| 8 | |
| 9 | // prevent this from being used in production |
| 10 | if (process.env.NODE_ENV === 'production' && process.env.HEROKU_PRODUCTION_APP) return next() |
| 11 | |
| 12 | throw new Error('Intentional error') |
| 13 | } |