(error)
| 6 | const DEBUG_MIDDLEWARE_TESTS = Boolean(JSON.parse(process.env.DEBUG_MIDDLEWARE_TESTS || 'false')) |
| 7 | |
| 8 | function shouldLogException(error) { |
| 9 | const IGNORED_ERRORS = [ |
| 10 | // Client connected aborted |
| 11 | 'ECONNRESET', |
| 12 | ] |
| 13 | |
| 14 | if (IGNORED_ERRORS.includes(error.code)) { |
| 15 | return false |
| 16 | } |
| 17 | |
| 18 | // We should log this exception |
| 19 | return true |
| 20 | } |
| 21 | |
| 22 | async function logException(error, req) { |
| 23 | if (process.env.NODE_ENV !== 'test' && shouldLogException(error)) { |