WebAssembly.CompileError object indicates an error during WebAssembly decoding or validation.

构造函数

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

实例特性

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

实例方法

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

范例

Creating a new CompileError instance

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

try {
  throw new WebAssembly.CompileError('Hello', 'someFile', 10);
} catch (e) {
  console.log(e instanceof CompileError); // true
  console.log(e.message);                 // "Hello"
  console.log(e.name);                    // "CompileError"
  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 'WebAssembly constructors' 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
CompileError 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
CompileError() 构造函数 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

图例

完整支持

完整支持

不支持

不支持

见实现注意事项。

另请参阅

元数据

  • 最后修改: