Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

255
Views
How do I get Node to break on a stack overflow?

Let's say I have a JS script like the following:

function recurse() {
    return recurse();
}
recurse();

If I run node recurse.js, it will of course fail with a "Maximum call stack size exceeded" error.

How do I get a debugger (for example, running in VS Code) to break before this exception happens, so I can see what's in the stack? I can attach a breakpoint, but it would take forever to hit this exception.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Maximum call stack size exceeded is an exception like any other. Wrap the call in a try/catch, and add a stop point inside the catch block, like so:

function recurse() {
    return recurse()
}

try {
  recurse()
} catch(e) {
  console.log(e) // <- stop here
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!