Home / Class/ RegistryError Class — ui Architecture

RegistryError Class — ui Architecture

Architecture documentation for the RegistryError class in errors.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  f1db3a8d_16e3_e5f1_cd46_0a25f77561fd["RegistryError"]
  f7f7a7b3_695f_ee49_7087_eefcb981b572["errors.ts"]
  f1db3a8d_16e3_e5f1_cd46_0a25f77561fd -->|defined in| f7f7a7b3_695f_ee49_7087_eefcb981b572
  fe062803_20af_23a9_ee4b_c717da91d1f4["constructor()"]
  f1db3a8d_16e3_e5f1_cd46_0a25f77561fd -->|method| fe062803_20af_23a9_ee4b_c717da91d1f4
  6a7eca04_1a30_b7d9_dacd_84826422d4a1["toJSON()"]
  f1db3a8d_16e3_e5f1_cd46_0a25f77561fd -->|method| 6a7eca04_1a30_b7d9_dacd_84826422d4a1

Relationship Graph

Source Code

packages/shadcn/src/registry/errors.ts lines 31–75

export class RegistryError extends Error {
  public readonly code: RegistryErrorCode
  public readonly statusCode?: number
  public readonly context?: Record<string, unknown>
  public readonly suggestion?: string
  public readonly timestamp: Date
  public readonly cause?: unknown

  constructor(
    message: string,
    options: {
      code?: RegistryErrorCode
      statusCode?: number
      cause?: unknown
      context?: Record<string, unknown>
      suggestion?: string
    } = {}
  ) {
    super(message)
    this.name = "RegistryError"
    this.code = options.code || RegistryErrorCode.UNKNOWN_ERROR
    this.statusCode = options.statusCode
    this.cause = options.cause
    this.context = options.context
    this.suggestion = options.suggestion
    this.timestamp = new Date()

    if (Error.captureStackTrace) {
      Error.captureStackTrace(this, this.constructor)
    }
  }

  toJSON() {
    return {
      name: this.name,
      message: this.message,
      code: this.code,
      statusCode: this.statusCode,
      context: this.context,
      suggestion: this.suggestion,
      timestamp: this.timestamp,
      stack: this.stack,
    }
  }
}

Frequently Asked Questions

What is the RegistryError class?
RegistryError is a class in the ui codebase, defined in packages/shadcn/src/registry/errors.ts.
Where is RegistryError defined?
RegistryError is defined in packages/shadcn/src/registry/errors.ts at line 31.

Analyze Your Own Codebase

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

Try Supermodel Free