WebAssembly.RuntimeError()
Baseline
Widely available
This feature is well established and works across many devices and browser versions. Itโs been available across browsers since โจ2017๋ 10์โฉ.
WebAssembly.RuntimeError()
์์ฑ์๋ WebAssembly์์ trap์ ์ง์ ํ ๋๋ง๋ค throw๋๋ ์ WebAssembly RuntimeError
๊ฐ์ฒด๋ฅผ ๋ง๋ญ๋๋ค.
Syntax
new WebAssembly.RuntimeError(message, fileName, lineNumber);
Parameters
message
Optional-
์ธ๊ฐ์ด ์ฝ์ ์์๋ ์ค๋ฅ ์ค๋ช .
fileName
Optional ๋นํ์ค-
์์ธ์ ์์ธ์ด ๋ ์ฝ๋๊ฐ ๋ค์ด์๋ ํ์ผ์ ์ด๋ฆ์ ๋๋ค.
lineNumber
Optional ๋นํ์ค-
์์ธ์ ์์ธ์ด ๋ ์ฝ๋์ ํ ๋ฒํธ์ ๋๋ค.
Properties
RuntimeError
์์ฑ์์๋ ๊ณ ์ ํ ๊ณ ์ ์์ฑ์ด ์์ง๋ง ํ๋กํ ํ์
์ฒด์ธ์ ํตํด ์ผ๋ถ ์์ฑ์ ์์ํฉ๋๋ค.
WebAssembly.RuntimeError.prototype.constructor
-
์ธ์คํด์ค์ ํ๋กํ ํ์ ์ ์์ฑํ ํจ์๋ฅผ ์ง์ ํฉ๋๋ค.
WebAssembly.RuntimeError.prototype.message
-
์๋ฌ ๋ฉ์์ง. ECMA-262๋
URIError
๊ฐ SpiderMonkey์์ ์์ฒดmessage
์์ฑ์ ์ ๊ณตํ๋๋ก ์ง์ ํ์ง๋งError.prototype.message
๋ฅผ ์์๋ฐ์ต๋๋ค. WebAssembly.RuntimeError.prototype.name
-
์ค๋ฅ ์ด๋ฆ.
Error
์์ ์์๋ฉ๋๋ค. WebAssembly.RuntimeError.prototype.fileName
-
์ด ์ค๋ฅ๋ฅผ ๋ฐ์์ํจ ํ์ผ์ ๊ฒฝ๋ก์ ๋๋ค.
Error
์์ ์์๋ฉ๋๋ค. WebAssembly.RuntimeError.prototype.lineNumber
-
์ด ์ค๋ฅ๊ฐ ๋ฐ์ํ ํ์ผ์ ํ ๋ฒํธ์ ๋๋ค.
Error
์์ ์์๋ฉ๋๋ค. WebAssembly.RuntimeError.prototype.columnNumber
-
์ด ์ค๋ฅ๊ฐ ๋ฐ์ํ ํ์ ์ด ๋ฒํธ์ ๋๋ค.
Error
์์ ์์๋ฉ๋๋ค. WebAssembly.RuntimeError.prototype.stack
-
์คํ ์ถ์ .
Error
์์ ์์๋ฉ๋๋ค.
Methods
RuntimeError
์์ฑ์์๋ ์์ฒด ๋ฉ์๋๊ฐ ์์ง๋ง ํ๋กํ ํ์
์ฒด์ธ์ ํตํด ์ผ๋ถ ๋ฉ์๋๋ฅผ ์์ํฉ๋๋ค.
WebAssembly.RuntimeError.prototype.toSource()
-
๋์ผํ ์ค๋ฅ๋ก ํ๊ฐ ๋ ์์๋ ์ฝ๋๋ฅผ ๋ฐํํฉ๋๋ค.
Error
์์ ์์๋ฉ๋๋ค. WebAssembly.RuntimeError.prototype.toString()
-
์ง์ ๋
Error
๊ฐ์ฒด๋ฅผ ๋ํ๋ด๋ ๋ฌธ์์ด์ ๋ฐํํฉ๋๋ค.Error
์์ ์์๋ฉ๋๋ค.
Examples
๋ค์์ ์ค๋ํซ์, ์๋ก์ด RuntimeError ์ธ์คํด์ค๋ฅผ ์์ฑํด, ๊ทธ ์์ธ๋ฅผ ์ฝ์์ ๊ธฐ๋กํฉ๋๋ค.
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
}
๋ช ์ธ์
Specification |
---|
WebAssembly JavaScript Interface # exceptiondef-runtimeerror |
ECMAScriptยฎ 2026 Language Specification # sec-native-error-types-used-in-this-standard |
๋ธ๋ผ์ฐ์ ํธํ์ฑ
Loadingโฆ