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 ...
随机推荐
- JSP页面读取数据中的数据内容,出现乱码现象的解决方法
1.首先要确保JSP页面的编码已修改为“utf-8”的字符编码: 2.然后再在jsp页面上添加代码进行设置: 先用getBytes()方法读出数据,然后再new String()方法设置格式为“utf ...
- 基于bs4库的HTML标签遍历方法
基于bs4库的HTML标签遍历方法 import requests r=requests.get('http://python123.io/ws/demo.html') demo=r.text HTM ...
- HNCPC2019H 有向图
题目 设\(f_i\)表示经过\(i\)的期望次数.那么显然答案\(ans_j=\sum\limits_{i=1}^nf_iP_{i,j}\). 我们可以轻松地列出转移式子: \[ f_1=\sum\ ...
- mysql 修改表字段默认值
alter table 表名 alter column 字段名 drop default; (若本身存在默认值,则先删除) alter table 表名 alter column 字段名 set de ...
- JSP中九大内置对象及其作用
jsp中有九大内置对象分别为:request,response,session,application,out,pageContext,page,config,exception. request:请 ...
- ELK-全文检索技术-elasticsearch集群及sde_restful
1 搭建ES集群 集群的说明 我们计划集群名称为:leyou-elastic,部署3个elasticsearch节点,分别是: node-01:http端口9201,TCP端口9301 n ...
- C# List<Object>值拷贝
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Run ...
- Linux系统安装使用实录--传送门(持续更新)
1.安装Linux系统 经过两种系统对比,发现ubuntu的资源依赖更方便更全, centos安装时可以配置开发环境,默认有安装的jdk,这一点比Ubuntu方便一点. win10+centos ...
- 【转】内核中的内存申请:kmalloc、vmalloc、kzalloc、kcalloc、get_free_pages
转自:https://www.cnblogs.com/yfz0/p/5829443.html 在内核模块中申请分配内存需要使用内核中的专用API:kmalloc.vmalloc.kzalloc.kca ...
- python 写matlab中的加性高斯白噪声AWGN
定义 原始信号:x 噪声信号:n 信噪比:SNR 信号长度:N def wgn(x, snr): snr = 10**(snr/10.0) xpower = np.sum(x**2)/len(x) n ...