JavaScript 查看stack trace
How can I get a JavaScript stack trace when I throw an exception?
Edit 2 (2017):
In all modern browsers you can simply call: console.trace(); (MDN Reference)
stacktrace.js
Generate, parse, and enhance JavaScript stack traces in all web browsers https://www.stacktracejs.com/
Debug and profile your JavaScript with a stack trace of function calls leading to an error (or any condition you specify).
stacktrace.js uses browsers' Error.stack mechanism to generate stack traces, parses them, enhances them with source maps and uses Promises to return an Array of StackFrames.
bower init
bower install stacktrace-js --save
或者
https://cdnjs.com/libraries/stacktrace.js 但是这是一个html页面
Resource blocked due to MIME type mismatch (X-Content-Type-Options: nosniff)
Check if the file path is correct and the file exists - in my case that was the issue - as I fixed it, the error disappeared
访问html页面,拿到https://cdnjs.cloudflare.com/ajax/libs/stacktrace.js/2.0.0/stacktrace.js
获取当前位置的堆栈信息
Get a stack trace from current location
var callback = function(stackframes) {
var stringifiedStack = stackframes.map(function(sf) {
return sf.toString();
}).join('\n');
console.log(stringifiedStack);
};
var errback = function(err) { console.log(err.message); };
StackTrace.get().then(callback).catch(errback);
//===> Promise(Array[StackFrame], Error)
//===> callback([
// StackFrame({functionName: 'func1', args: [], fileName: 'file.js', lineNumber: 203, columnNumber: 9}),
// StackFrame({functionName: 'func2', args: [], fileName: 'http://localhost:3000/file.min.js', lineNumber: 1, columnNumber: 3284})
//])
JavaScript 查看stack trace的更多相关文章
- XDebug 自动开启PHP Stack Trace, 导致PHP Log 超1G
昨天早上突然发现测试服务器空间满了,用du挨个文件夹查看,发现是php debug log占地极大,有的log直接有1G,打开后发现极其多的php stack trace. 立刻到主服务器查看,主服务 ...
- 三、jdk工具之jstack(Java Stack Trace)
目录 一.jdk工具之jps(JVM Process Status Tools)命令使用 二.jdk命令之javah命令(C Header and Stub File Generator) 三.jdk ...
- hadoop执行hbase插入表操作,出错:Stack trace: ExitCodeException exitCode=1:(xjl456852原创)
在执行hbase和mapreduce融合时,将hdfs上的文本文件插入到hbase中,我没有使用"胖包"(胖包就是将项目依赖的jar包放入项目打包后的lib目录中),而是直接将hb ...
- This is very likely to create a memory leak. Stack trace of thread错误分析
1.问题描述 启动tomcat部署项目时,报This is very likely to create a memory leak. Stack trace of thread错误. 29-May-2 ...
- dump 分析模式之 INCORRECT STACK TRACE - djm2005dy的专栏 - 博客频道 - CSDN.NET
Dump 分析模式之 INCORRECT STACK TRACE dump 分析模式之 INCORRECT STACK TRACE 翻译自 MDA-Anthology Page288 初学者常犯的错 ...
- Rethrowing exceptions and preserving the full call stack trace
refer:http://weblogs.asp.net/fmarguerie/archive/2008/01/02/rethrowing-exceptions-and-preserving-the- ...
- Eclipse下Android开发错误之Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace
升级了Android版本后,在运行应用时提示: [2013-11-27 10:37:35 - Dex Loader] Unable to execute dex: java.nio.BufferOve ...
- Android -- java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
使用Bundle 的getParcelableArray 出现了以下错误: Class not found when unmarshallingjava.lang.ClassNotFoundExcep ...
- 让Xcode的 stack trace信息可读
让Xcode的 stack trace信息可读 昨天在写 iOS 代码的时候,调试的时候模拟器崩溃了.异常停在了如下整个 main 函数的入口处: int main(int argc, char *a ...
随机推荐
- MySQL-快速入门(7)索引
1.什么是索引 索引是对数据库表中一列或者多列的值进行排序的一种结构.索引是在存储引擎中实现的,每种存储引擎中的索引不一定完全相同. MySQL中索引的存储类型有两种:btree和hash.MyISA ...
- 剑指Offer编程题(Java实现)——两个链表的第一个公共结点
题目描述: 输入两个链表,找出它们的第一个公共结点. 思路一: 设 A 的长度为 a + c,B 的长度为 b + c,其中 c 为尾部公共部分长度,可知 a + c + b = b + c + a. ...
- win10远程桌面报出现身份验证错误,要求的函数不受支持
win10远程桌面报出现身份验证错误,要求的函数不受支持 编写人:左丘文 2019-6-6 公司换了一台新笔记本电脑,是win10操作系统,刚想远程连接一下服务器,发现以前很正常的功能,发现不行了.网 ...
- JS基础篇--JS获取元素的宽高以及offsetTop,offsetLeft等的属性值
$(obj).width()与$(obj).height() $(obj).width()与$(obj).height() :jquery方式获取元素的宽高,不包括滚动条与工具条 $(obj).wid ...
- linux中文件IO
一. linux常用文件IO接口 1.1. 文件描述符 1.1.1. 文件描述符的本质是一个数字,这个数字本质上是进程表中文件描述符表的一个表项,进程通过文件描述符作为index去索引查表得到文件表指 ...
- linux下定时器的实现
简介: linux下经常有这样的需求,需要定时轮询执行某种任务,当然,用shell脚本的话,crontab和at就可以满足要求.如果从C语言的角度来看,实现定时器也是一个比较简单的任务,因为具有普遍性 ...
- 04: DjangoRestFramework使用
Django其他篇 目录: 1.1 DjangoRestFramework基本使用 1.2 drf认证&权限 模块 1.3 djangorestframework 序列化 1.4 django ...
- 最长上升子序列(LIS) Easy
A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given ...
- python学习笔记(14):可视化分析
一.Matplotlib 1.用于创建出版质量图表的绘图工具库 2.目的的为Python构建一个Matlab式的绘图接口 3.import matplotlib.pyplot as plt:pyplo ...
- k3 cloud提示超出产品激活有效期
k3 cloud提示超出产品激活有效期,请联系系统管理员登录管理中心进行产品激活(激活路径:许可中心-许可管理-产品激活) 首先进入管理中心:一次点击许可中心-产品激活 复制激活串号并点击金蝶正版验证 ...