zl程序教程

您现在的位置是:首页 >  后端

当前栏目

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

JSNode Error in Stack more show Trace
2023-09-14 09:00:49 时间

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");
}