TransformStreamDefaultController.error()

The error() method of the TransformStreamDefaultController interface errors both sides of the stream. Any further interactions with it will fail with the given error message, and any chunks in the queue will be discarded.

Syntax

TransformStreamDefaultController.error(reason);

Parameters

reason

A string containing the error message to be returned on any further interaction with the stream.

Examples

In this example the error() method is used when a chunk contains a symbol.

case 'symbol':
  controller.error("Cannot send a symbol as a chunk part")
  break

Specifications

Specification
Streams Standard
# ts-default-controller-error

Browser compatibility

BCD tables only load in the browser