MCPcopy Create free account
hub / github.com/fastify/fastify / streamError

Method streamError

lib/log-controller.js:100–108  ·  view source on GitHub ↗

* Logs stream-level errors that occur after headers have been sent. * Premature closes are logged at `info`; other errors at `warn`. * * @param {Error} error The stream error. * @param {object} request Fastify request object. * @param {object} reply Fastify reply o

(error, request, reply, metadata)

Source from the content-addressed store, hash-verified

98 * @param {object} [metadata] Extra contextual data (unused).
99 */
100 streamError (error, request, reply, metadata) {
101 if (this.isLogDisabled(request)) { return }
102
103 if (error.code === 'ERR_STREAM_PREMATURE_CLOSE') {
104 reply.log.info({ res: reply }, 'stream closed prematurely')
105 } else {
106 reply.log.warn({ err: error }, 'response terminated with an error with headers already sent')
107 }
108 }
109
110 /**
111 * Logs a "route not found" message at `info` level.

Callers 1

logStreamErrorFunction · 0.80

Calls 3

isLogDisabledMethod · 0.95
infoMethod · 0.80
warnMethod · 0.80

Tested by

no test coverage detected