ReadableStreamDefaultController: error() メソッド
error()
は ReadableStreamDefaultController
インターフェイスのメソッドで、関連づけられたストリームとの今後のやり取りをエラーにします。
メモ: error()
メソッドは複数回呼び出すことができ、ストリームが読み取り可能でないときに呼び出すことができます。
構文
js
error(e)
引数
e
-
今後のやり取りを失敗させるエラー。
返値
なし (undefined
)。
例外
TypeError
-
ソースオブジェクトが
ReadableStreamDefaultController
ではないか、何らかの理由でストリームが読み取り可能ではありません。
例
仕様にある基になるプッシュソースと背圧サポートのある読み取り可能なストリームの例は、ReadablestreamDefaultController.desiredSize
を使用してストリームがいっぱいになったことを手動で検出し、背圧を適用しています。 また、error()
を使用して、依存しているシステムの別の部分に障害が発生した場合に手動でストリームのエラーをトリガーする良い例を示しています。
仕様書
Specification |
---|
Streams # rs-default-controller-error |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
error |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.