WebAssembly.LinkError()

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

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 (en-US)
์Šคํ… ์ถ”์ . Error๋ฅผ ์ƒ์†๋ฐ›์Šต๋‹ˆ๋‹ค.

Methods

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

WebAssembly.LinkError.prototype.toSource() (en-US)
๋™์ผํ•œ ์˜ค๋ฅ˜๋กœ ํ‰๊ฐ€ ๋  ์ˆ˜์žˆ๋Š” ์ฝ”๋“œ๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. Error๋ฅผ ์ƒ์†๋ฐ›์Šต๋‹ˆ๋‹ค.
WebAssembly.LinkError.prototype.toString()
์ง€์ •๋œ Error ๊ฐ์ฒด๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ๋ฌธ์ž์—ด์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. Error๋ฅผ ์ƒ์†๋ฐ›์Šต๋‹ˆ๋‹ค.

Examples

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

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
}

Specifications

Specification Status Comment
WebAssembly JavaScript Interface
The definition of 'WebAssembly constructors' in that specification.
Working Draft Initial WebAssembly draft definition.
ECMAScript (ECMA-262)
The definition of 'NativeError' in that specification.
Living Standard Definition of standard NativeError types.

Browser compatibility

BCD tables only load in the browser

See also