MCPcopy Index your code
hub / github.com/github/docs / shouldLogException

Function shouldLogException

middleware/handle-errors.js:8–20  ·  view source on GitHub ↗
(error)

Source from the content-addressed store, hash-verified

6const DEBUG_MIDDLEWARE_TESTS = Boolean(JSON.parse(process.env.DEBUG_MIDDLEWARE_TESTS || 'false'))
7
8function 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
22async function logException(error, req) {
23 if (process.env.NODE_ENV !== 'test' && shouldLogException(error)) {

Callers 1

logExceptionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected