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 ...
随机推荐
- 剑指Offer编程题(Java实现)——链表中倒数第k个结点
题目描述 输入一个链表,输出该链表中倒数第k个结点. 注意: 该题目不可以用先反转链表再输出第k个结点的方式,因为反转链表会改变该结点的next指向 思路一 使用栈Stack倒序存储,顺序pop第k个 ...
- r子集代码实现(递归)
#!/usr/bin/env python #coding:utf-8 SET_START = 1 SET_END = 9 SUB_LEN = 10 def r_subset(i, r, pre, a ...
- SQL SERVER中求上月、本月和下月的第一天和最后一天[转]
--上月的第一天 ),,,) ,,) --上月的最后一天 ),,,)),)+' 23:59:59' ,,)) --本月的第一天 ),,) ),)') --本月的最后一天 ),,,,)),)+' 23: ...
- java中Map的put函数和get函数用法
---内容开始--- 没有比较完整的说明他们的用法,一般就只能看源函数,但是看起来比较的费劲. 那么究竟put函数和get函数的用法是如何的呢? 当然java中的Map集合是有Key和Value的. ...
- Phone List POJ-3630 字典树 or 暴力
Phone List POJ-3630 字典树 or 暴力 题意 目前有 t 组数据, n 个电话号码,如果拨打号码的时候 先拨通了某个号码,那么这一串号码就无法全部拨通. 举个例子 911 和 91 ...
- Python 入门之Python简介
Python 入门之Python简介 1.Python简介: (1) Python的出生: python的创始人为吉多·范罗苏姆(Guido van Rossum)(中文名字:龟叔).1989年的 ...
- 用Java构建一个简单的WebSocket聊天室
前言 首先对于一个简单的聊天室,大家应该都有一定的概念了,这里我们省略用户模块的讲解,而是单纯的先说说聊天室的几个功能:自我对话.好友交流.群聊.离线消息等. 今天我们要做的demo就能帮我们做到这一 ...
- nginx运行出现 file not found 错误处理原因
在阿里云装nginx+php+mysql nginx运行出现 file not found 错误处理原因 1,第一情况 location ~ \.php$ { # root html; fastcgi ...
- Consul服务发现在windows下简单使用
目录 基本介绍: 服务连接: 客户端: 系列章节: 回到顶部 基本介绍: 安装: 下载地址:https://www.consul.io/downloads.html 运行: consul agent ...
- glup安装
资料参考:http://www.w3ctrain.com/2015/12/22/gulp-for-beginners/ 1.在安装 node 的环境后: npm install gulp -g 全局安 ...