Skip to content

Function: forwardRenderError()

API / @xmachines/play-view / index / forwardRenderError

function forwardRenderError(handler, registry, error, name, info): boolean;

Defined in: packages/play-view/src/provider-guards.ts:116

Gives one report of json-render to the handler of the host, and tells the caller whether the report is a failure of the root.

The five providers hold one rule for a report, and this function holds it for them:

  • The report goes to handler, the onRenderError of the host. Without it, the report goes to the handler that defineRegistry put on registry. Without that one too, the report goes to the one [json-render] console line of core. info goes through without a change, and a handler that throws gives its error to reportError.
  • A failure of the ROOT (info.kind "root") leaves no view on the screen, and the provider contains it as a failure of the view: it shows its fallback, and it calls its onError. The function therefore writes no console line for such a report. The containment reports the failure to onError, or writes its own line, and a second line would report one failure two times. A handler of the host still receives it.
  • A component can call the handler itself, at the context of the renderer, with the two arguments (error, name). Such a call is no failure of the root. It reaches the handler with the info { kind: "element", type: name }, because the handler of the host declares a required info. Without a handler, it goes to one console.error line, as the component writes when the context holds no handler.

Parameters

ParameterTypeDescription
handler| OnRenderError | undefinedThe onRenderError of the host, or undefined.
registryobjectThe registry of the caller, which can hold the handler of defineRegistry.
errorunknownThe value that failed.
namestringThe name of the report: the element type, or the action name of a chain.
info| RenderErrorInfo | undefinedThe info of the report, or undefined for a call of a component.

Returns

boolean

true for a failure of the root, which the caller contains.