MCPcopy
hub / github.com/github/docs / triggerError

Function triggerError

middleware/trigger-error.js:4–13  ·  view source on GitHub ↗
(req, res, next)

Source from the content-addressed store, hash-verified

2
3// IMPORTANT: Leave this function as `async` even though it doesn't need to be!
4export 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}

Callers

nothing calls this directly

Calls 1

nextFunction · 0.50

Tested by

no test coverage detected