WebTransportError:streamErrorCode 属性
注意:此功能在 Web Workers 中可用。
streamErrorCode 是 WebTransportError 接口的一个只读属性,它返回一个 0-255 范围内的数字,表示此错误的应用协议错误代码;如果不可用,则返回 null。
值
一个数字,或 null。
示例
js
const url = "not-a-url";
async function initTransport(url) {
try {
// Initialize transport connection
const transport = new WebTransport(url);
// The connection can be used once ready fulfills
await transport.ready;
// …
} catch (error) {
const msg = `Transport initialization failed.
Reason: ${error.message}.
Source: ${error.source}.
Error code: ${error.streamErrorCode}.`;
console.log(msg);
}
}
规范
| 规范 |
|---|
| WebTransport # dom-webtransporterror-streamerrorcode |
浏览器兼容性
加载中…