Home / Function/ constructor() — ui Function Reference

constructor() — ui Function Reference

Architecture documentation for the constructor() function in errors.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  17189458_a52e_0a1d_b798_0ef051254efa["constructor()"]
  da0cde29_64de_06f0_bb41_3d144f47ecfc["RegistryParseError"]
  17189458_a52e_0a1d_b798_0ef051254efa -->|defined in| da0cde29_64de_06f0_bb41_3d144f47ecfc
  style 17189458_a52e_0a1d_b798_0ef051254efa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shadcn/src/registry/errors.ts lines 199–218

  constructor(public readonly item: string, parseError: unknown) {
    let message = `Failed to parse registry item: ${item}`

    if (parseError instanceof z.ZodError) {
      message = `Failed to parse registry item: ${item}\n${parseError.errors
        .map((e) => `  - ${e.path.join(".")}: ${e.message}`)
        .join("\n")}`
    }

    super(message, {
      code: RegistryErrorCode.PARSE_ERROR,
      cause: parseError,
      context: { item },
      suggestion:
        "The registry item may be corrupted or have an invalid format. Please make sure it returns a valid JSON object. See https://ui.shadcn.com/schema/registry-item.json.",
    })

    this.parseError = parseError
    this.name = "RegistryParseError"
  }

Subdomains

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 199.

Analyze Your Own Codebase

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

Try Supermodel Free