A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/URIError/URIError below:

URIError() constructor - JavaScript | MDN

URIError() constructor

Baseline Widely available

URIError() 생성자는 전역 URI 핸들링 함수가 잘못 사용될 때 오류를 생성합니다.

구문
new URIError();
new URIError(message);
new URIError(message, fileName);
new URIError(message, fileName, lineNumber);
매개변수
message Optional

사람이 읽을 수 있는 에러에 대한 설명.

fileName Optional

예외를 일으킨 코드가 들어있는 파일 이름.

lineNumber Optional

예외를 일으킨 코드의 줄 수.

예제 URIError 잡기
try {
  decodeURIComponent("%");
} catch (e) {
  console.log(e instanceof URIError); // true
  console.log(e.message); // "malformed URI sequence"
  console.log(e.name); // "URIError"
  console.log(e.fileName); // "Scratchpad/1"
  console.log(e.lineNumber); // 2
  console.log(e.columnNumber); // 2
  console.log(e.stack); // "@Scratchpad/2:2:3\n"
}
URIError 생성하기
try {
  throw new URIError("Hello", "someFile.js", 10);
} catch (e) {
  console.log(e instanceof URIError); // true
  console.log(e.message); // "Hello"
  console.log(e.name); // "URIError"
  console.log(e.fileName); // "someFile.js"
  console.log(e.lineNumber); // 10
  console.log(e.columnNumber); // 0
  console.log(e.stack); // "@Scratchpad/2:2:9\n"
}
명세 브라우저 호환성 같이 보기

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4