JavaScript & Error Types

JavaScript提供了8个错误对象,这些错误对象会根据错误类型在try / catch表达式中引发:

Error

EvalError

RangeError

ReferenceError

SyntaxError

TypeError

URIError

Error

message

name

EvalError

eval()

RangeError

RangeError: argument is not a valid code point

RangeError: invalid array length

RangeError: invalid date

RangeError: precision is out of range

RangeError: radix must be an integer

RangeError: repeat count must be less than infinity

RangeError: repeat count must be non-negative

ReferenceError

ReferenceError: "x" is not defined

ReferenceError: assignment to undeclared variable "x"

ReferenceError: can't access lexical declaration 'X' before initialization

ReferenceError: deprecated caller or arguments usage

ReferenceError: invalid assignment left-hand side

ReferenceError: reference to undefined property "x"

SyntaxError

SyntaxError: "0"-prefixed octal literals and octal escape seq. are deprecated

SyntaxError: "use strict" not allowed in function with non-simple parameters

SyntaxError: "x" is a reserved identifier

SyntaxError: JSON.parse: bad parsing

SyntaxError: Malformed formal parameter

SyntaxError: Unexpected token

SyntaxError: Using //@ to indicate sourceURL pragmas is deprecated. Use //# instead

SyntaxError: a declaration in the head of a for-of loop can't have an initializer

SyntaxError: applying the 'delete' operator to an unqualified name is deprecated

SyntaxError: for-in loop head declarations may not have initializers

SyntaxError: function statement requires a name

SyntaxError: identifier starts immediately after numeric literal

SyntaxError: illegal character

SyntaxError: invalid regular expression flag "x"

SyntaxError: missing ) after argument list

SyntaxError: missing ) after condition

SyntaxError: missing : after property id

SyntaxError: missing ; before statement

SyntaxError: missing = in const declaration

SyntaxError: missing ] after element list

SyntaxError: missing formal parameter

SyntaxError: missing name after . operator

SyntaxError: missing variable name

SyntaxError: missing } after function body

SyntaxError: missing } after property list

SyntaxError: redeclaration of formal parameter "x"

SyntaxError: return not in function

SyntaxError: test for equality (==) mistyped as assignment (=)?

SyntaxError: unterminated string literal

TypeError

TypeError: "x" has no properties

TypeError: "x" is (not) "y"

TypeError: "x" is not a constructor

TypeError: "x" is not a function

TypeError: "x" is not a non-null object

TypeError: "x" is read-only

TypeError: 'x' is not iterable

TypeError: More arguments needed

TypeError: Reduce of empty array with no initial value

TypeError: can't access dead object

TypeError: can't access property "x" of "y"

TypeError: can't define property "x": "obj" is not extensible

TypeError: can't delete non-configurable array element

TypeError: can't redefine non-configurable property "x"

TypeError: cannot use 'in' operator to search for 'x' in 'y'

TypeError: cyclic object value

TypeError: invalid 'instanceof' operand 'x'

TypeError: invalid Array.prototype.sort argument

TypeError: invalid arguments

TypeError: invalid assignment to const "x"

TypeError: property "x" is non-configurable and can't be deleted

TypeError: setting getter-only property "x"

TypeError: variable "x" redeclares argument

URIError

decodeURI()

decodeURIComponent()

encodeURI()

encodeURIComponent()

refs

https://flaviocopes.com/javascript-errors/

https://flaviocopes.com/javascript-custom-errors/



xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


JavaScript & Error Types的更多相关文章

  1. javascript Error对象详解

    今天谈一下在IE浏览器下返回执行错误的Javascript代码所在的问题.其中在IE浏览器下,如果你使用了try-catch,那么当出现异常的时候,IE浏览器会传递一个Error对象. ~~~怎么通过 ...

  2. [RN] windows7 安装 Realm Studio 后,打开报错 A JavaScript error occurred in the main process

    windows7  安装 Realm Studio 后,打开报错 报错如下: A JavaScript error occurred in the main process Uncaught Exce ...

  3. JavaScript data types and data structures

    JavaScript data types and data structures Programming languages all have built-in data structures, b ...

  4. 如何捕获和分析 JavaScript Error

    前端工程师都知道 JavaScript 有基本的异常处理能力.我们可以 throw new Error(),浏览器也会在我们调用 API 出错时抛出异常.但估计绝大多数前端工程师都没考虑过收集这些异常 ...

  5. WHY JAVASCRIPT NEEDS TYPES

    Types have a bad reputation for making code harder to read, adding unnecessary ceremony, and in gene ...

  6. JS高级调试技巧:捕获和分析 JavaScript Error详解

    前端工程师都知道 JavaScript 有基本的异常处理能力.我们可以 throw new Error(),浏览器也会在我们调用 API 出错时抛出异常.但估计绝大多数前端工程师都没考虑过收集这些异常 ...

  7. Javascript Error: 11233 Content-Length mismatch

    Today I got a error in fiddler: Failed to obtain request body. System.IO.InvalidDataException The re ...

  8. electron项目踩坑--A JavaScript error occurred in the main process:document is not defined

    前言 记录electron-vue项目开发中遇到的一个错误,运行时报错如图: 控制台报错如下: ReferenceError: document is not defined at Object.&l ...

  9. javascript error

    IE 6下expected identifier,string or number(缺少标示符.字符串或数字)其实就是多了一个逗号,之前没发现

随机推荐

  1. virtualenv安装和配置

    安装命令 命令执行结束 配 执行命令:virtualenv testvir 执行完成:会在当前目录下生成如下文件夹 进入到testvir目录 进入Scripts目录: 进入虚拟环境:执行 activa ...

  2. how2j SpringMVC学习心得

    http://how2j.cn/k/springmvc/springmvc-form/618.html 注意 addProduct.jsp 是放在了WebContent(即web目录)下,访问的时候, ...

  3. MySql(二)索引的设计与使用

    MySql(二)索引的设计与使用 一.索引概述 二.设计索引的原则 三.BTREE索引与HASH索引 一.索引概述 所有Mysql列类型都可以被索引,对相关列使用索引时提高select操作性能的最佳途 ...

  4. python----类,面向对象(封装、继承、多态)(属性,方法)

    什么是对象? 对象是内存中专门用来存储数据的一块区域 对象中可以存放各种数据(数字.代码等) 对象由三部分组成(1,对象标识(id)2,对象类型(type)3,对象的值(value)) 面向对象编程是 ...

  5. Linux常用命令详解(第三章)(ping、kill、seq、du、df、free、date、tar)

    本章命令(共7个): 1 2 3 4 5 6 7 8 ping kill seq du df free date tar 1." ping " 作用:向网络主机发送ICMP(检测主 ...

  6. 【Java】构造方法

    成员变量声明时初始化和构造方法中初始化的区别 声明时为成员变量赋值,那每次创建这个类的对象都是同一个值. 构造方法初始化,每次创建对象时可以为每一个对象赋不同的值(此时要通过有参构造). 无返回值类型 ...

  7. Redis命令之setbit

    setbit的作用是,对key上存储的字符串,设置或清除指定偏移量上的位(bit). 语法如下: SETBIT key offset value key是要操作的对象的键. offset是操作对象上的 ...

  8. B - Play on Words

    如果这个图是欧拉路,则每个顶点的出度等于入度.即out[i] = in[i] 如果这个图是半欧拉图,则起点的出度比入度大1,终点的入度比出度大1.其余顶点的出度等于入度.如果满足上述条件,就可以将所有 ...

  9. BZOJ4566 [Haoi2016]找相同字符【SAM】

    BZOJ4566 [Haoi2016]找相同字符 给定两个字符串\(s和t\),要求找出两个字符串中所有可以相互匹配的子串对的数量 首先考虑可以怎么做,我们可以枚举\(t\)串的前缀\(t'\),然后 ...

  10. acm内容