onError()
Subscribe to failures of the Dashlet handle. This is
the error channel: failures that the library can observe but not resolve —
timeouts, host errors, and errors thrown by your own listeners.
1. Signature
onError(listener: (error: unknown) => void): () => void;
-
listener— receives the error value (unknown: aTimeoutError, a host error payload, or an exception thrown by a listener). -
Returns an unsubscribe function.
2. What routes here
The library’s documented routing (exact, as implemented):
-
Listener errors. An exception thrown by an
onInitoronUpdatelistener — including a replayedonInitdelivery to a late subscriber — is caught and delivered to everyonErrorlistener. This is the primary source of errors on a well-behaved dashlet page: a bug in your render function surfaces here, not in an uncaught exception. -
Replaced host global (rich client only). When other code on the page replaces
window.osDashletInit, the rich client’s selection-change callbacks go to that code instead of the dashlet. Once the dashlet has settled in the rich client, everyonErrorlistener receives one plainErrorwhose message starts withDashlet: window.osDashletInit was replaced by other code. It arrives at most once per dashlet instance, also for a replacement made before the init settled. The library does not take the global back and does not forward host calls to the foreign function: remove the second dashlet layer from the page. No report is made in the webclient, in standalone, or for a rich client that settled through the webclient wire, and a secondinstallDashletGlobalcall is not a replacement. After the init settled only assignments are observed: a later global function declaration,Object.defineProperty,deleteor a second copy of the library goes unreported. -
No cascade. If an
onErrorlistener itself throws, that exception is swallowed — an error listener must not cascade. (This keeps a broken error handler from taking down the host call or the other listeners.)