RE: [Q] q.delay(x, t) vs. q.delay(t).thenResolve(x)

85 views
Skip to first unread message

Domenic Denicola

unread,
May 13, 2013, 1:08:52 PM5/13/13
to q-con...@googlegroups.com
You may have run into The Great Unhandled Rejected Promise Bug of 2013:

https://github.com/kriskowal/q/issues/238

Thankfully a kindly contributor fixed that in master, and we'll be releasing a bugfix release shortly. If you try the latest version from

https://rawgithub.com/kriskowal/q/master/q.js

does that fix the problem?


From: q-con...@googlegroups.com [q-con...@googlegroups.com] on behalf of David Jeschke [djes...@gmail.com]
Sent: Monday, May 13, 2013 13:00
To: q-con...@googlegroups.com
Subject: [Q] q.delay(x, t) vs. q.delay(t).thenResolve(x)

I would have thought that q.delay(x, t) would be equivalent to q.delay(t).thenResolve(x) however I found a difference when x is a rejected promise. Specifically,

var q = require('q');
q.delay(100).then(function() { return q.reject(new Error('foo')); }).fail(function(err) {});

will exit without error, while:

var q = require('q');
q.delay(q.reject(new Error('foo')), 100).fail(function(err) {});

will exit with:

Unhandled rejected promise: Error: foo
    at Object.<anonymous> (/test1.js:2:18)
    at node.js:901:3
From previous event:
    at Object.<anonymous> (/test1.js:2:3)
    at node.js:901:3

Is this a bug in Q or in my understanding? Thanks!

--
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.
 
 

David Jeschke

unread,
May 13, 2013, 1:38:57 PM5/13/13
to q-con...@googlegroups.com
Thanks for the quick response, Domenic. I just tried it and unfortunately the result is the same. I have opened a new case for it:

Reply all
Reply to author
Forward
0 new messages