-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
48 lines (34 loc) · 1.02 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
---
title: TransformStreamDefaultController.error()
slug: Web/API/TransformStreamDefaultController/error
page-type: web-api-instance-method
tags:
- API
- Method
- Reference
- error
- TransformStreamDefaultController
browser-compat: api.TransformStreamDefaultController.error
---
{{DefaultAPISidebar("Streams API")}}
The **`error()`** method of the {{domxref("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
```js
error(reason)
```
### Parameters
- `reason`
- : A string containing the error message to be returned on any further interaction with the stream.
### Return value
None ({{jsxref("undefined")}}).
## Examples
In this example the `error()` method is used when a chunk contains a symbol.
```js
case 'symbol':
controller.error("Cannot send a symbol as a chunk part")
break
```
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}