Skip to content

Instantly share code, notes, and snippets.

@aheckmann
Created June 14, 2012 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aheckmann/2931898 to your computer and use it in GitHub Desktop.
Save aheckmann/2931898 to your computer and use it in GitHub Desktop.
fake stack overflow
var times = 0;
function loop () {
++times;
if (times >= 30000) throw new Error('fake stack overflow');
return loop;
}
function start () {
var fn;
while (fn = loop()) fn();
console.log('looped %d times', times);
}
start();
// Error: fake stack overflow
// at loop (repl:1:52)
// at start (repl:1:41)
// at repl:1:1
// at REPLServer.eval (repl.js:80:21)
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment