WebTransportError: source 属性
注意:此功能在 Web Workers 中可用。
source 是 WebTransportError 接口的一个只读属性,它返回一个枚举值,表示错误的来源。
值
一个枚举值;可以是 stream 或 session。
示例
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-source |
浏览器兼容性
加载中…