这篇翻译不完整。请帮忙从英语翻译这篇文章

WebAssembly.LinkError() 构造器创建一个新的WebAssembly LinkError 对象, 该对象表明一个模块创建时(besides traps from the start function)发生的错误.

 

句法

new WebAssembly.LinkError(message, fileName, lineNumber)

Parameters

message 可选
自然语言对错误的描述.
fileName 可选
包含抛出异常代码的代码文件名.
lineNumber 可选
抛出异常的代码行号.

Properties

LinkError 不包含自己独立的属性, 它仅仅继承了原型链上的属性.

WebAssembly.LinkError.prototype.constructor
指明创建该实体的构造函数.
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.

Methods

The LinkError constructor contains no methods of its own, however, it does inherit some methods through the prototype chain.

WebAssembly.LinkError.prototype.toSource()
返回可以执行并得到与该错误对象相同的源代码.
WebAssembly.LinkError.prototype.toString()
返回一个可以说明该 Error 对象的文字. 继承自 Error.

Examples

下列代码片段创建了一个新的 LinkError 实例, 并将其打印到控制台:

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
}

Specifications

Specification Status Comment
WebAssembly JavaScript Interface
WebAssembly constructors
Working Draft Initial WebAssembly draft definition.
ECMAScript Latest Draft (ECMA-262)
NativeError
Draft Definition of standard NativeError types.

Browser compatibility

Update compatibility data on GitHub
DesktopMobileServer
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.js
Basic supportChrome Full support 57Edge Full support 16Firefox Full support 52
Notes
Full support 52
Notes
Notes Disabled in the Firefox 52 Extended Support Release (ESR).
IE No support NoOpera Full support 44Safari Full support 11WebView Android Full support 57Chrome Android Full support 57Edge Mobile Full support Yes
Disabled
Full support Yes
Disabled
Disabled This feature is behind the Experimental JavaScript Features preference.
Firefox Android Full support 52
Notes
Full support 52
Notes
Notes Disabled in the Firefox 52 Extended Support Release (ESR).
Opera Android ? Safari iOS Full support 11Samsung Internet Android Full support 7.0nodejs Full support 8.0.0

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
See implementation notes.
See implementation notes.
User must explicitly enable this feature.
User must explicitly enable this feature.

See also

文档标签和贡献者

此页面的贡献者: budblack
最后编辑者: budblack,