このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docsコミュニティーについてもっと知り、仲間になるにはこちらから。
URIError
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月.
* Some parts of this feature may have varying levels of support.
URIError オブジェクトは、グローバル URI 処理関数が間違った方法で使用された場合のエラーを表します。
In this article
コンストラクター
URIError()新しい
URIErrorオブジェクトを生成します。
インスタンスプロパティ
URIError.prototype.messageエラーメッセージです。 ECMA-262 において
URIErrorは自身のmessageプロパティを提供するべきとされていますが、SpiderMonkey ではError.prototype.messageを継承しています。URIError.prototype.nameエラー名です。
Errorから継承しています。URIError.prototype.fileNameこのエラーが発生したファイルのパスです。
Errorから継承しています。URIError.prototype.lineNumberこのエラーが発生したファイル内の行番号です。
Errorから継承しています。URIError.prototype.columnNumberこのエラーが発生した行内の桁番号です。
Errorから継承しています。URIError.prototype.stackスタックトレースです。
Errorから継承しています。
例
>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-native-error-types-used-in-this-standard-urierror> |