js try catch 获取错误信息

try{

  alert(i);

}catch(e){

console.log(e.message,e.name,e.lineNumber)

}

message —— 错误提示信息
fileName —— 表示出错代码所在文件
lineNumber —— 出错代码所在行数
stack —— 出错堆栈信息
name —— 异常对象名/类型 

原文地址:https://www.cnblogs.com/phpwyl/p/13801546.html