Movatterモバイル変換


[0]ホーム

URL:


  1. 개발자를 위한 웹 기술
  2. JavaScript
  3. JavaScript 참고서
  4. 표준 내장 객체
  5. URIError
  6. URIError() constructor

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

View in EnglishAlways switch to English

URIError() constructor

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015년 7월.

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

구문

js
new URIError();new URIError(message);new URIError(message, fileName);new URIError(message, fileName, lineNumber);

매개변수

messageOptional

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

fileNameOptional

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

lineNumberOptional

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

예제

URIError 잡기

js
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 생성하기

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

명세

Specification
ECMAScript® 2026 Language Specification
# sec-nativeerror-constructors

브라우저 호환성

같이 보기

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp