constructor() — ui Function Reference
Architecture documentation for the constructor() function in errors.ts from the ui codebase.
Entity Profile
Dependency Diagram
graph TD 0762990b_6160_6b07_5d5b_0aa19816a9b8["constructor()"] 6483a6d4_db49_af2f_d375_716b937db79e["RegistryFetchError"] 0762990b_6160_6b07_5d5b_0aa19816a9b8 -->|defined in| 6483a6d4_db49_af2f_d375_716b937db79e style 0762990b_6160_6b07_5d5b_0aa19816a9b8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/shadcn/src/registry/errors.ts lines 126–160
constructor(
public readonly url: string,
statusCode?: number,
public readonly responseBody?: string,
cause?: unknown
) {
// Use the error detail from the server if available
const baseMessage = statusCode
? `Failed to fetch from registry (${statusCode}): ${url}`
: `Failed to fetch from registry: ${url}`
const message =
typeof cause === "string" && cause
? `${baseMessage} - ${cause}`
: baseMessage
let suggestion = "Check your network connection and try again."
if (statusCode === 404) {
suggestion =
"The requested resource was not found. Check the URL or item name."
} else if (statusCode === 500) {
suggestion = "The registry server encountered an error. Try again later."
} else if (statusCode && statusCode >= 400 && statusCode < 500) {
suggestion = "There was a client error. Check your request parameters."
}
super(message, {
code: RegistryErrorCode.FETCH_ERROR,
statusCode,
cause,
context: { url, responseBody },
suggestion,
})
this.name = "RegistryFetchError"
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does constructor() do?
constructor() is a function in the ui codebase, defined in packages/shadcn/src/registry/errors.ts.
Where is constructor() defined?
constructor() is defined in packages/shadcn/src/registry/errors.ts at line 126.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free