Response.error()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2017.
Response
接口的 error()
方法返回一个包含网络错误相关信息的新 Response
对象。
备注:
这主要与 Service Workers 有关;如果你愿意,可以使用 error 方法返回错误。错误响应的 type
被设置为 error
。
备注:
一个“错误”的 Response
不会真正地暴露给脚本:例如 fetch()
的“错误”响应将会返回 promise 的 reject 状态。
语法
js
Response.error()
参数
无
返回值
一个 Response
对象。
示例
待定(似乎还没有在任何地方得到支持)。
规范
Specification |
---|
Fetch # ref-for-dom-response-error① |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
error() static method |
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.