Home / Function/ setErrorStatusCode() — fastify Function Reference

setErrorStatusCode() — fastify Function Reference

Architecture documentation for the setErrorStatusCode() function in error-status.js from the fastify codebase.

Entity Profile

Dependency Diagram

graph TD
  5ee6eb7d_4088_f91b_550f_0028afddd78a["setErrorStatusCode()"]
  4ec4607b_7c06_5516_6405_4e9c1d0e1c1a["error-status.js"]
  5ee6eb7d_4088_f91b_550f_0028afddd78a -->|defined in| 4ec4607b_7c06_5516_6405_4e9c1d0e1c1a
  style 5ee6eb7d_4088_f91b_550f_0028afddd78a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

lib/error-status.js lines 7–12

function setErrorStatusCode (reply, err) {
  if (!reply[kReplyHasStatusCode] || reply.statusCode === 200) {
    const statusCode = err && (err.statusCode || err.status)
    reply.code(statusCode >= 400 ? statusCode : 500)
  }
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does setErrorStatusCode() do?
setErrorStatusCode() is a function in the fastify codebase, defined in lib/error-status.js.
Where is setErrorStatusCode() defined?
setErrorStatusCode() is defined in lib/error-status.js at line 7.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free