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, theonRenderErrorof the host. Without it, the report goes to the handler thatdefineRegistryput onregistry. Without that one too, the report goes to the one[json-render]console line of core.infogoes through without a change, and a handler that throws gives its error toreportError. - 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 itsonError. The function therefore writes no console line for such a report. The containment reports the failure toonError, 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 requiredinfo. Without a handler, it goes to oneconsole.errorline, as the component writes when the context holds no handler.
Parameters
| Parameter | Type | Description |
|---|---|---|
handler | | OnRenderError | undefined | The onRenderError of the host, or undefined. |
registry | object | The registry of the caller, which can hold the handler of defineRegistry. |
error | unknown | The value that failed. |
name | string | The name of the report: the element type, or the action name of a chain. |
info | | RenderErrorInfo | undefined | The 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.