This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

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

js
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 ์ธ์Šคํ„ด์Šค๋ฅผ ์ž‘์„ฑํ•ด, ๊ทธ ์ƒ์„ธ๋ฅผ ์ฝ˜์†”์— ๊ธฐ๋กํ•ฉ๋‹ˆ๋‹ค.

js
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

๋ธŒ๋ผ์šฐ์ € ํ˜ธํ™˜์„ฑ

See also