MCPcopy
hub / github.com/fastify/fastify / defaultErrorHandler

Function defaultErrorHandler

lib/error-handler.js:83–102  ·  view source on GitHub ↗
(error, request, reply)

Source from the content-addressed store, hash-verified

81}
82
83function defaultErrorHandler (error, request, reply) {
84 setErrorHeaders(error, reply)
85 setErrorStatusCode(reply, error)
86 if (reply.statusCode < 500) {
87 if (!reply.log[kDisableRequestLogging]) {
88 reply.log.info(
89 { res: reply, err: error },
90 error?.message
91 )
92 }
93 } else {
94 if (!reply.log[kDisableRequestLogging]) {
95 reply.log.error(
96 { req: request, res: reply, err: error },
97 error?.message
98 )
99 }
100 }
101 reply.send(error)
102}
103
104function fallbackErrorHandler (error, reply, cb) {
105 const res = reply.raw

Callers

nothing calls this directly

Calls 5

setErrorHeadersFunction · 0.85
setErrorStatusCodeFunction · 0.85
infoMethod · 0.80
errorMethod · 0.80
sendMethod · 0.80

Tested by

no test coverage detected