MCPcopy
hub / github.com/fastify/fastify / setErrorStatusCode

Function setErrorStatusCode

lib/error-status.js:7–12  ·  view source on GitHub ↗
(reply, err)

Source from the content-addressed store, hash-verified

5} = require('./symbols')
6
7function setErrorStatusCode (reply, err) {
8 if (!reply[kReplyHasStatusCode] || reply.statusCode === 200) {
9 const statusCode = err && (err.statusCode || err.status)
10 reply.code(statusCode >= 400 ? statusCode : 500)
11 }
12}
13
14module.exports = { setErrorStatusCode }

Callers 3

preHandlerCallbackInnerFunction · 0.85
defaultErrorHandlerFunction · 0.85
wrapThenableFunction · 0.85

Calls 1

codeMethod · 0.80

Tested by

no test coverage detected