class ViewRenderError
extends Error
Since 0.6.0

A view component threw while rendering, or returned undefined — almost always a missing return, since null and false are the deliberate render-nothing values and yield an empty string. A failure raised from a throwing component carries the original as cause, so the underlying fault is never swallowed.

Examples

Example 1

try {
  await engine.render(Page, props);
} catch (error) {
  if (error instanceof ViewRenderError) {
    logger.error('view render failed', { component: error.message });
  }
}

Constructors

ViewRenderError(
component: Component<never>,
reason: string,
options?: ErrorOptions
)

Builds the error, naming the component in the message and forwarding any original fault through the standard cause chain.

Parameters
component: Component<never>

The component that failed to render

reason: string

What went wrong, phrased to follow the component's name

optional
options: ErrorOptions

Standard ErrorOptions; a throwing component passes the original error as cause

Usage

import { ViewRenderError } from "view-plugin/src/index.ts";