Skip to content

Function: attachRenderErrorHandler()

API / @xmachines/play-actor / attachRenderErrorHandler

function attachRenderErrorHandler<TRegistry>(registry, handler): TRegistry;

Defined in: packages/play-actor/src/provider-guards.ts:64

Clone a component registry and inject an onRenderError handler.

The handler is defined as a non-enumerable, configurable own property on the clone (per D-19 — one injection convention for all framework renderers), so it overrides any handler set at defineRegistry level without showing up when the registry’s component entries are enumerated.

The caller’s registry is never mutated — a shallow clone is returned. Callers that need per-instance handlers (e.g. an onRenderError prop on ActorProvider) can therefore share one defineRegistry result across providers safely.

Type Parameters

Type ParameterDescription
TRegistry extends objectThe framework-specific component registry type.

Parameters

ParameterTypeDescription
registryTRegistryThe component registry from defineRegistry().registry.
handlerRenderErrorHandlerCalled with (error, componentName) when a catalog component throws during render.

Returns

TRegistry

A shallow clone of registry with onRenderError attached.