Created
April 6, 2013 05:41
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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 | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
interesting. +1