Skip to content

Instantly share code, notes, and snippets.

@domenic
Created April 6, 2013 05:41
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 domenic/5325002 to your computer and use it in GitHub Desktop.
Save domenic/5325002 to your computer and use it in GitHub Desktop.
Sample of long stack traces in upcoming Q release: https://github.com/kriskowal/q/tree/long-stacks
"use strict";
var Q = require("q");
function doA() {
return Q.resolve("A");
}
function doB() {
return Q.resolve("B");
}
function doC() {
return Q.resolve("C");
}
function doABC() {
return doA().then(function aFulfillment() {
return doB().then(function bFulfillment() {
return doC().then(function cFulfillment() {
throw new Error("boo!");
});
});
});
}
doABC().done(); // Will re-throw the error, but with the long stack trace.
doABC().catch(function (err) {
console.log(err.stack); // also works here
});
Error: boo!
at cFulfillment (C:\Users\Domenic\Dropbox\Programming\GitHub\q\test.js:21:23)
From previous event:
at bFulfillment (C:\Users\Domenic\Dropbox\Programming\GitHub\q\test.js:20:26)
From previous event:
at aFulfillment (C:\Users\Domenic\Dropbox\Programming\GitHub\q\test.js:19:22)
From previous event:
at doABC (C:\Users\Domenic\Dropbox\Programming\GitHub\q\test.js:18:18)
at Object.<anonymous> (C:\Users\Domenic\Dropbox\Programming\GitHub\q\test.js:29:1) # or 27:1 for the .done()
@stefanpenner
Copy link

interesting. +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment