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. 为什么Go自带的日志默认输出到os.Stderr?

    为什么Go自带的日志默认输出到os.Stderr? - 知乎 https://www.zhihu.com/question/67629357 Note that the Go runtime writ ...

  2. mdns

    mdns mdns_百度百科 https://baike.baidu.com/item/mdns 在计算机网络中 , 多播DNS ( mDNS )协议将主机名解析为不包含本地名称服务器的小型网络中的I ...

  3. DP中的树上边/点覆盖问题

    目录 树上边覆盖问题 例:luoguP2016 战略游戏 简述题意: Solution: Code 树上点覆盖问题 简述题意 Solution Code: 树上边覆盖问题 例:luoguP2016 战 ...

  4. valgrind和Kcachegrind性能分析工具详解

    一.valgrind介绍 valgrind是运行在Linux上的一套基于仿真技术的程序调试和分析工具,用于构建动态分析工具的装备性框架.它包括一个工具集,每个工具执行某种类型的调试.分析或类似的任务, ...

  5. (十三)整合 SpringSecurity 框架,实现用户权限管理

    整合 SpringSecurity 框架,实现用户权限管理 1.Security简介 1.1 基础概念 1.2 核心API解读 2.SpringBoot整合SpringSecurity 2.1 流程描 ...

  6. Java——StringBuffer,String总结

    StringBuffer介绍: Java StringBuffer和StringBuilder类 当对字符串进行修改的时候,需要使用StringBuffer和StringBuilder类. Strin ...

  7. Spark练习之创建RDD(集合、本地文件),RDD持久化及RDD持久化策略

    Spark练习之创建RDD(集合.本地文件) 一.创建RDD 二.并行化集合创建RDD 2.1 Java并行创建RDD--计算1-10的累加和 2.2 Scala并行创建RDD--计算1-10的累加和 ...

  8. IDEA插件及相关使用技巧

    IDEA插件及相关使用技巧 一.插件 图片背景插件background Image Plus 翻译插件Translation CodeGlance右侧显示代码 Grep Console自定义设置控制台 ...

  9. k8s~kubectl常用命令

    查看所有 pod 列表, -n 后跟 namespace, 查看指定的命名空间 kubectl get pod kubectl get pod -n kube kubectl get pod -o w ...

  10. Codeforces Round #664 (Div. 2) C. Boboniu and Bit Operations

    传送门:cf1395C 题意 c[i]=a[i]&b[j],b[j]是b数组中任意一个,求c[1] | c[2] | ... | c[n]最小值. 题解 经典的二进制枚举答案,因为a和b的最大 ...