KcdMp.onError
Registers a function that is told of the page’s errors and of the game’s complaints about the page.
fn(error) is called with an Error for each uncaught script error and each unhandled promise rejection of the page,
and for the game’s own complaints about it: when messages toward the page were dropped because more arrived at once than
the game delivers (256 KB a second), the error’s code is "budget"; the other errors have no code. One handler that
throws is logged and does not stop the rest.
Syntax
Section titled “Syntax”KcdMp.onError(fn)| Parameter | Type | |
|---|---|---|
fn |
(error: Error) => void |
called with each error |
Returns
Section titled “Returns”() => void - a function that takes the handler off again
Example
Section titled “Example”KcdMp.onError((error) => { if (error.code === "budget") { showBanner("The game could not keep up - some updates were skipped."); }});See also
Section titled “See also”KcdMp.log.error · the Logging and errors group of the index
