WebAssembly.LinkError object indicates an error during module instantiation (besides traps from the start function).

构造函数

WebAssembly.LinkError()
创建新的 WebAssembly.LinkError 对象。

实例特性

WebAssembly.LinkError.prototype.message
Error message. Although ECMA-262 specifies that URIError should provide its own message property, in SpiderMonkey , it inherits Error.prototype.message .
WebAssembly.LinkError.prototype.name
Error name. Inherited from Error .
WebAssembly.LinkError.prototype.fileName
Path to file that raised this error. Inherited from Error .
WebAssembly.LinkError.prototype.lineNumber
Line number in file that raised this error. Inherited from Error .
WebAssembly.LinkError.prototype.columnNumber
Column number in line that raised this error. Inherited from Error .
WebAssembly.LinkError.prototype.stack
Stack trace. Inherited from Error .

实例方法

WebAssembly.LinkError.prototype.toSource()
Returns code that could eval to the same error. Inherited from Error .
WebAssembly.LinkError.prototype.toString()
Returns a string representing the specified Error object.. Inherited from Error .

范例

Creating a new LinkError instance

The following snippet creates a new LinkError instance, and logs its details to the console:

try {
  throw new WebAssembly.LinkError('Hello', 'someFile', 10);
} catch (e) {
  console.log(e instanceof LinkError); // true
  console.log(e.message);                 // "Hello"
  console.log(e.name);                    // "LinkError"
  console.log(e.fileName);                // "someFile"
  console.log(e.lineNumber);              // 10
  console.log(e.columnNumber);            // 0
  console.log(e.stack);                   // returns the location where the code was run
}
					

规范

规范
WebAssembly JavaScript 接口
The definition of 'LinkError' in that specification.
ECMAScript (ECMA-262)
The definition of 'NativeError' in that specification.

浏览器兼容性

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. 更新 GitHub 上的兼容性数据
Desktop Mobile Server
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet Node.js
LinkError Chrome 57 Edge 16 Firefox 52
52
Disabled in the Firefox 52 Extended Support Release (ESR).
IE No Opera 44 Safari 11 WebView Android 57 Chrome Android 57 Firefox Android 52
52
Disabled in the Firefox 52 Extended Support Release (ESR).
Opera Android 43 Safari iOS 11 Samsung Internet Android 7.0 nodejs 8.0.0
LinkError() 构造函数 Chrome 57 Edge 16 Firefox 52
52
Disabled in the Firefox 52 Extended Support Release (ESR).
IE No Opera 44 Safari 11 WebView Android 57 Chrome Android 57 Firefox Android 52
52
Disabled in the Firefox 52 Extended Support Release (ESR).
Opera Android 43 Safari iOS 11 Samsung Internet Android 7.0 nodejs 8.0.0

图例

完整支持

完整支持

不支持

不支持

见实现注意事项。

另请参阅

元数据

  • 最后修改: