WebAssembly.RuntimeError()
constructor creates a new WebAssembly
RuntimeError
object — the type that is thrown whenever WebAssembly specifies a
trap
.
new WebAssembly.RuntimeError(message, fileName, lineNumber)
message
可选
Human-readable description of the error.
fileName
可选
The name of the file containing the code that caused the exception.
lineNumber
可选
The line number of the code that caused the exception.
The following snippet creates a new
RuntimeError
instance, and logs its details to the console:
try {
throw new WebAssembly.RuntimeError('Hello', 'someFile', 10);
} catch (e) {
console.log(e instanceof RuntimeError); // true
console.log(e.message); // "Hello"
console.log(e.name); // "RuntimeError"
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.RunTimeError constructor' in that specification. |
|
ECMAScript (ECMA-262)
The definition of 'NativeError constructor' in that specification. |
| Desktop | Mobile | Server | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
RuntimeError()
构造函数
|
Chrome 57 | Edge 16 |
Firefox
52
|
IE No | Opera 44 | Safari 11 | WebView Android 57 | Chrome Android 57 |
Firefox Android
52
|
Opera Android 43 | Safari iOS 11 | Samsung Internet Android 7.0 | nodejs 8.0.0 |
完整支持
不支持
见实现注意事项。
WebAssembly
WebAssembly.Module
WebAssembly.Global
WebAssembly.Instance
WebAssembly.Memory
WebAssembly.Table
WebAssembly.CompileError
WebAssembly.LinkError
WebAssembly.RuntimeError
Object
Object.prototype.__defineGetter__()
Object.prototype.__defineSetter__()
Object.prototype.__lookupGetter__()
Object.prototype.__lookupSetter__()
Object.prototype.hasOwnProperty()
Object.prototype.isPrototypeOf()
Object.prototype.propertyIsEnumerable()
Object.prototype.toLocaleString()
Object.prototype.toSource()
Object.prototype.toString()
Object.prototype.valueOf()
Object.setPrototypeOf()