Skip to content

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.

KcdMp.onError(fn)
Parameter Type
fn (error: Error) => void called with each error

() => void - a function that takes the handler off again

KcdMp.onError((error) => {
if (error.code === "budget") {
showBanner("The game could not keep up - some updates were skipped.");
}
});

KcdMp.log.error · the Logging and errors group of the index