From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../reference/global_objects/urierror/index.html | 103 +++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 files/ja/web/javascript/reference/global_objects/urierror/index.html (limited to 'files/ja/web/javascript/reference/global_objects/urierror/index.html') diff --git a/files/ja/web/javascript/reference/global_objects/urierror/index.html b/files/ja/web/javascript/reference/global_objects/urierror/index.html new file mode 100644 index 0000000000..efb13e2539 --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/urierror/index.html @@ -0,0 +1,103 @@ +--- +title: URIError +slug: Web/JavaScript/Reference/Global_Objects/URIError +tags: + - Error + - JavaScript + - Object + - Reference + - URIError +translation_of: Web/JavaScript/Reference/Global_Objects/URIError +--- +
{{JSRef}}
+ +

URIError オブジェクトは、グローバル URI 処理関数が間違った方法で使用された場合のエラーを表します。

+ +

コンストラクター

+ +
+
{{jsxref("Global_Objects/URIError/URIError", "URIError()")}}
+
新しい URIError オブジェクトを生成します。
+
+ +

インスタンスプロパティ

+ +
+
{{jsxref("Error.prototype.message", "URIError.prototype.message")}}
+
エラーメッセージです。 ECMA-262 において {{jsxref("URIError")}} は自身の message プロパティを提供するべきとされていますが、 SpiderMonkey では {{jsxref("Error.prototype.message")}} を継承しています。
+
{{jsxref("Error.prototype.name", "URIError.prototype.name")}}
+
エラー名です。 {{jsxref("Error")}} から継承しています。
+
{{jsxref("Error.prototype.fileName", "URIError.prototype.fileName")}}
+
このエラーが発生したファイルのパスです。 {{jsxref("Error")}} から継承しています。
+
{{jsxref("Error.prototype.lineNumber", "URIError.prototype.lineNumber")}}
+
このエラーが発生したファイル内の行番号です。 {{jsxref("Error")}} から継承しています。
+
{{jsxref("Error.prototype.columnNumber", "URIError.prototype.columnNumber")}}
+
このエラーが発生した行内の桁番号です。 {{jsxref("Error")}} から継承しています。
+
{{jsxref("Error.prototype.stack", "URIError.prototype.stack")}}
+
スタックトレースです。 {{jsxref("Error")}} から継承しています。
+
+ +

+ +

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

仕様書

+ + + + + + + + + + + + +
仕様書
{{SpecName('ESDraft', '#sec-native-error-types-used-in-this-standard-syntaxerror', 'SyntaxError')}}
+ +

ブラウザーの互換性

+ +
+ + +

{{Compat("javascript.builtins.URIError")}}

+
+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf