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.LinkError()

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์›”โฉ.

The WebAssembly.LinkError() constructor creates a new WebAssembly LinkError object, which indicates an error during module instantiation (besides traps from the start function).

WebAssembly.LinkError() ์ƒ์„ฑ์ž๋Š” ์ƒˆ WebAssembly LinkError ๊ฐ์ฒด๋ฅผ ๋งŒ๋“ญ๋‹ˆ๋‹ค. ์ด ๊ฐ์ฒด๋Š” ๋ชจ๋“ˆ ์ธ์Šคํ„ด์Šคํ™” ์ค‘์˜ ์˜ค๋ฅ˜๋ฅผ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค (์‹œ์ž‘ ํ•จ์ˆ˜์˜ traps์™€ ํ•จ๊ป˜).

Syntax

js
new WebAssembly.LinkError(message, fileName, lineNumber);

Parameters

message Optional

์‚ฌ๋žŒ์ด ์ฝ์„ ์ˆ˜ ์žˆ๋Š” ์˜ค๋ฅ˜ ์„ค๋ช….

fileName Optional ๋น„ํ‘œ์ค€

์˜ˆ์™ธ์˜ ์›์ธ์ด ๋œ ์ฝ”๋“œ๊ฐ€ ๋“ค์–ด์žˆ๋Š” ํŒŒ์ผ์˜ ์ด๋ฆ„์ž…๋‹ˆ๋‹ค.

lineNumber Optional ๋น„ํ‘œ์ค€

์˜ˆ์™ธ์˜ ์›์ธ์ด ๋œ ์ฝ”๋“œ์˜ ํ–‰ ๋ฒˆํ˜ธ์ž…๋‹ˆ๋‹ค.

Properties

LinkError ์ƒ์„ฑ์ž์—๋Š” ๊ณ ์œ  ํ•œ ๊ณ ์œ  ์†์„ฑ์ด ์—†์ง€๋งŒ ํ”„๋กœํ†  ํƒ€์ž… ์ฒด์ธ์„ ํ†ตํ•ด ์ผ๋ถ€ ์†์„ฑ์„ ์ƒ์†ํ•ฉ๋‹ˆ๋‹ค.

WebAssembly.LinkError.prototype.constructor

์ธ์Šคํ„ด์Šค์˜ ํ”„๋กœํ†  ํƒ€์ž…์„ ์ž‘์„ฑํ•œ ํ•จ์ˆ˜๋ฅผ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.

WebAssembly.LinkError.prototype.message

์—๋Ÿฌ ๋ฉ”์‹œ์ง€. ECMA-262๋Š” URIError๊ฐ€ SpiderMonkey์—์„œ ์ž์ฒด message ์†์„ฑ์„ ์ œ๊ณตํ•˜๋„๋ก ์ง€์ •ํ–ˆ์ง€๋งŒ Error.prototype.message๋ฅผ ์ƒ์†๋ฐ›์Šต๋‹ˆ๋‹ค.

WebAssembly.LinkError.prototype.name

์—๋Ÿฌ ์ด๋ฆ„. Error๋ฅผ ์ƒ์†๋ฐ›์Šต๋‹ˆ๋‹ค.

WebAssembly.LinkError.prototype.fileName

ํ•ด๋‹น ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•œ ํŒŒ์ผ์˜ ๊ฒฝ๋กœ. Error๋ฅผ ์ƒ์†๋ฐ›์Šต๋‹ˆ๋‹ค.

WebAssembly.LinkError.prototype.lineNumber

์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•œ ํŒŒ์ผ์˜ ํ–‰ ๋ฒˆํ˜ธ. Error๋ฅผ ์ƒ์†๋ฐ›์Šต๋‹ˆ๋‹ค.

WebAssembly.LinkError.prototype.columnNumber

์ด ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•œ ํ–‰์˜ ์—ด ๋ฒˆํ˜ธ์ž…๋‹ˆ๋‹ค.. Error๋ฅผ ์ƒ์†๋ฐ›์Šต๋‹ˆ๋‹ค.

WebAssembly.LinkError.prototype.stack

์Šคํ… ์ถ”์ . Error๋ฅผ ์ƒ์†๋ฐ›์Šต๋‹ˆ๋‹ค.

Methods

LinkError ์ƒ์„ฑ์ž์—๋Š” ์ž์ฒด ๋ฉ”์„œ๋“œ๊ฐ€ ์—†์ง€๋งŒ ํ”„๋กœํ†  ํƒ€์ž… ์ฒด์ธ์„ ํ†ตํ•ด ์ผ๋ถ€ ๋ฉ”์„œ๋“œ๋ฅผ ์ƒ์†ํ•ฉ๋‹ˆ๋‹ค.

WebAssembly.LinkError.prototype.toSource()

๋™์ผํ•œ ์˜ค๋ฅ˜๋กœ ํ‰๊ฐ€ ๋  ์ˆ˜์žˆ๋Š” ์ฝ”๋“œ๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. Error๋ฅผ ์ƒ์†๋ฐ›์Šต๋‹ˆ๋‹ค.

WebAssembly.LinkError.prototype.toString()

์ง€์ •๋œ Error ๊ฐ์ฒด๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ๋ฌธ์ž์—ด์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. Error๋ฅผ ์ƒ์†๋ฐ›์Šต๋‹ˆ๋‹ค.

Examples

๋‹ค์Œ snippet์€ ์ƒˆ LinkError ์ธ์Šคํ„ด์Šค๋ฅผ ๋งŒ๋“ค๊ณ  ์ฝ˜์†”์— ์„ธ๋ถ€ ์ •๋ณด๋ฅผ ๊ธฐ๋กํ•ฉ๋‹ˆ๋‹ค.

js
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
}

๋ช…์„ธ์„œ

Specification
WebAssembly JavaScript Interface
# exceptiondef-linkerror
ECMAScriptยฎ 2026 Language Specification
# sec-native-error-types-used-in-this-standard

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

See also