From 012ee621791b6895e637f96e6523027951768f25 Mon Sep 17 00:00:00 2001 From: Irvin Date: Wed, 16 Feb 2022 02:03:27 +0800 Subject: remove inline style for zh-CN --- .../reference/global_objects/error/index.html | 66 +++++++++++----------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'files/zh-cn/web/javascript/reference/global_objects/error/index.html') diff --git a/files/zh-cn/web/javascript/reference/global_objects/error/index.html b/files/zh-cn/web/javascript/reference/global_objects/error/index.html index b9334c7969..fe9ad2deed 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/error/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/error/index.html @@ -49,37 +49,37 @@ const y = new Error('I was constructed via the "new" keyword!');

Error 类型

-

除了通用的Error构造函数外,JavaScript还有6个其他类型的错误构造函数。更多客户端异常,详见 Exception Handling Statements

+

除了通用的Error构造函数外,JavaScript还有6个其他类型的错误构造函数。更多客户端异常,详见 Exception Handling Statements

-
{{jsxref("EvalError")}}
+
{{jsxref("EvalError")}}
创建一个error实例,表示错误的原因:与 {{jsxref("Global_Objects/eval", "eval()")}} 有关。
-
{{jsxref("InternalError")}} {{non-standard_inline}}
+
{{jsxref("InternalError")}} {{non-standard_inline}}
创建一个代表Javascript引擎内部错误的异常抛出的实例。 如: "递归太多".
-
{{jsxref("RangeError", "RangeError")}}
+
{{jsxref("RangeError", "RangeError")}}
创建一个error实例,表示错误的原因:数值变量或参数超出其有效范围。
-
{{jsxref("ReferenceError")}}
+
{{jsxref("ReferenceError")}}
创建一个error实例,表示错误的原因:无效引用。
-
{{jsxref("SyntaxError")}}
+
{{jsxref("SyntaxError")}}
创建一个error实例,表示错误的原因:{{jsxref("Global_Objects/eval", "eval()")}}在解析代码的过程中发生的语法错误。
-
{{jsxref("TypeError")}}
+
{{jsxref("TypeError")}}
创建一个error实例,表示错误的原因:变量或参数不属于有效类型。
-
{{jsxref("URIError")}}
+
{{jsxref("URIError")}}
创建一个error实例,表示错误的原因:给 {{jsxref("Global_Objects/encodeURI", "encodeURI()")}}或  {{jsxref("Global_Objects/decodeURI", "decodeURI()")}}传递的参数无效。
@@ -141,7 +141,7 @@ const y = new Error('I was constructed via the "new" keyword!');

你可能希望自定义基于Error的异常类型,使得你能够 throw new MyError() 并可以使用 instanceof MyError 来检查某个异常的类型. 这种需求的通用解决方法如下.

-
+

注意,在FireFox中抛出自定义类型的异常会显示不正确的行号和文件名。

@@ -170,49 +170,49 @@ try { console.log(e.message); // 'custom message' } -
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-

规范

+

规范

@@ -244,11 +244,11 @@ try {
-

浏览器兼容性

+

浏览器兼容性

{{Compat("javascript.builtins.Error")}}
-

相关链接

+

相关链接