Q also extends its optional support for long stack traces; this helps developers to manage the stack property of an error by providing the entire reasons of errors and rejection reason rather to simply halt without any meaningful or readable error.
The following function is one such example where the error was not handled in a meaningful manner and when someone tried to execute this snippet, he/she experienced meaningless and untraceable errors:
function TheDepthOfMyCode() { Q.delay(100).done(function explode() { throw new Error("hello I am your error Stack!"); }); } TheDepthOfMyCode ();
This will gives us a raw-looking unhelpful stack trace looking similar to this:
Error: hello I am your error Stack! at explode (/path/to/test.js5:166) at _fulfilled (/path/to/test.js:q:54) at resolvedValue.promiseDispatch.done (/path/to/q.js:923:20) at makePromise.promise.promiseDispatch (/path/to/q.js:400:23) at pending (/path/to/q.js:397:39) at...