error

fun error(error: JsError = definedExternally)(source)

The error() method of the WritableStreamDefaultController interface causes any future interactions with the associated stream to error.

MDN Reference