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. Linux下unix socket 读写 抓包

    Linux下unix socket 读写 抓包-ubuntuer-ChinaUnix博客 http://blog.chinaunix.net/uid-9950859-id-247877.html

  2. jackson学习之五:JsonInclude注解

    欢迎访问我的GitHub https://github.com/zq2599/blog_demos 内容:所有原创文章分类汇总及配套源码,涉及Java.Docker.Kubernetes.DevOPS ...

  3. cnpm安装依赖时报Error: Cannot find module 'core-js/modules/es6.regexp.constructor'

    解决方案:npm install core-js@2 大致猜测:cnpm掉包所致...

  4. PyQt中ui编译成窗体.py,中文乱码

    我在Eric工具下编译的 解决办法: 1.打开 C:\Python27\Lib\site-packages\eric4\i18n,将中文资源包的名称"GB2312."去掉,变成er ...

  5. scp命令------两服务器之间传输数据

    scp就是secure copy,是用来进行远程文件拷贝的.数据传输使用 ssh,并且和ssh 使用相同的认证方式,提供相同的安全保证 . 与rcp 不同的是,scp 在需要进行验证时会要求你输入密码 ...

  6. 每个开发人员都应该知道的WebSockets知识

    转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具.解决方案和服务,赋能开发者. 原文出处:https://blog.bitsrc.io/deep-dive-into-websockets- ...

  7. linux(3) 处理目录的常用命令

    目录命令总览 ls(英文全拼:list files): 列出目录及文件名 cd(英文全拼:change directory):切换目录 pwd(英文全拼:print work directory):显 ...

  8. Codeforces Round #668 (Div. 2)【ABCD】

    比赛链接:https://codeforces.com/contest/1405 A. Permutation Forgery 题意 给出一个大小为 $n$ 的排列 $p$,定义 \begin{equ ...

  9. 【noi 2.6_6045】开餐馆(DP)

    题意:有N个地址,从中选一些开餐馆,要保证相邻餐馆的距离大于k.问最大利润. 解法:f[i]表示在前 i 个地址中选的最大利润. 1 #include<cstdio> 2 #include ...

  10. python的threading的使用(join方法,多线程,锁threading.Lock和threading.Condition

    一.开启多线程方法一 import threading,time def write1(): for i in range(1,5): print('1') time.sleep(1) def wri ...