Strange undefined exception within Q

25 views
Skip to first unread message

// ravi

unread,
Jun 19, 2013, 10:36:46 AM6/19/13
to q-con...@googlegroups.com

Hello all,

before I file an Issue at GitHub, I thought I would run it by here. I have some proprietary code using Q which triggers a strange error in Q 0.9.6: on line 120 in q.js, Q tries to throw an exception that it catches except the exception is undefined. The relevant block of code:

try {
task();

} catch (e) {
if (isNodeJS) {
// In node, uncaught exceptions are considered fatal errors.
// Re-throw them synchronously to interrupt flushing!

// Ensure continuation if the uncaught exception is suppressed
// listening "uncaughtException" events (as domains does).
// Continue in next event to avoid tick recursion.
domain && domain.exit();
setTimeout(flush, 0);
domain && domain.enter();

throw e;

} else {
// In browsers, uncaught exceptions are not fatal.
// Re-throw them asynchronously to avoid slow-downs.
setTimeout(function() {
throw e;
}, 0);
}
}


Unfortunately I cannot share the code I have that causes this problem, but I am trying to write up a test case that reproduces it in a simple way.

What I found strange is that the issue is not some exception from Q that I am not catching but that some exception throw within Q is undefined. I am curious of Kris or someone knowledgeable of the Q code thinks if that could legitimately happen simply through wrong usage of Q on my part?

Thank you,

—ravi


Domenic Denicola

unread,
Jun 19, 2013, 10:39:57 AM6/19/13
to q-con...@googlegroups.com
I could see this possibly happening if you had code somewhere that did `Q.reject()`, i.e. `Q.reject(undefined)`.
________________________________________
From: q-con...@googlegroups.com [q-con...@googlegroups.com] on behalf of // ravi [ravi-...@g8o.net]
Sent: Wednesday, June 19, 2013 10:36
To: q-con...@googlegroups.com
Subject: [Q] Strange undefined exception within Q

Hello all,

try {
task();

throw e;

Thank you,

—ravi


--
You received this message because you are subscribed to the Google Groups "Q Continuum (JavaScript)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to q-continuum...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


// ravi

unread,
Jun 19, 2013, 11:04:49 AM6/19/13
to q-con...@googlegroups.com
On Jun 19, 2013, at 10:39 AM, Domenic Denicola <dom...@domenicdenicola.com> wrote:
> I could see this possibly happening if you had code somewhere that did `Q.reject()`, i.e. `Q.reject(undefined)`.


Domenic, that was exactly it. A dfrd.resolve() with no args was the culprit. Thank you! That was an amazingly quick response.

—ravi
Reply all
Reply to author
Forward
0 new messages