[Node.js] Show More Lines in a Node.js Error Stack Trace

本文介绍如何在Node.js中增加错误堆栈跟踪限制,以便在遇到错误时能够查看更详细的堆栈信息,这对于定位和解决深层代码问题非常有帮助。

Sometimes you are one or two lines short from finding the cause of the error in the stack trace but you can't because Nodejs displays only a handful of lines. In this lesson, you will learn how to increase the stack trace limit to show more lines

 

Error.stackTraceLimit = 15;

main();
function main() {
  one();
}
function one() {
  two();
}
function two() {
  three();
}
function three() {
  four();
}
function four() {
  five();
}
function five() {
  six();
}
function six() {
  seven();
}
function seven() {
  eight();
}
function eight() {
  nine();
}
function nine() {
  ten();
}
function ten() {
  eleven();
}
function eleven() {
  twelve();
}
function twelve() {
  throw new Error("I can't see the whole stack strace");
}

 

转载于:https://www.cnblogs.com/Answer1215/p/10321521.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值