New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot resolve(value).timeout(ms); #829

Closed
assaf opened this Issue Oct 28, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@assaf

assaf commented Oct 28, 2015

const Bluebird = require('bluebird');
Bluebird.resolve(1).timeout(200);
Unhandled rejection TypeError: Cannot read property 'apply' of undefined
    at bound (domain.js:280:13)
    at runBound (domain.js:293:12)
    at tryCatcher (/Users/assaf/Dropbox/projects/webapp/node_modules/bluebird/js/release/util.js:11:23)
    at Promise._settlePromiseFromHandler (/Users/assaf/Dropbox/projects/webapp/node_modules/bluebird/js/release/promise.js:486:31)
    at Promise._settlePromise (/Users/assaf/Dropbox/projects/webapp/node_modules/bluebird/js/release/promise.js:549:18)
    at Promise._settlePromiseCtx (/Users/assaf/Dropbox/projects/webapp/node_modules/bluebird/js/release/promise.js:586:10)
    at Async._drainQueue (/Users/assaf/Dropbox/projects/webapp/node_modules/bluebird/js/release/async.js:130:12)
    at Async._drainQueues (/Users/assaf/Dropbox/projects/webapp/node_modules/bluebird/js/release/async.js:135:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/assaf/Dropbox/projects/webapp/node_modules/bluebird/js/release/async.js:16:14)
    at processImmediate [as _immediateCallback] (timers.js:368:17)

It seems that timeout works correctly as long as the promise is not fulfilled/rejected. So this will work:

Bluebird.resolve( Bluebird.resolve( Bluebird.delay(1) ) ).timeout(200);

This will not work:

Bluebird.resolve( Bluebird.resolve(0) ).timeout(200);
@petkaantonov

This comment has been minimized.

Show comment
Hide comment
@petkaantonov

petkaantonov Oct 29, 2015

Owner

Can you give a standalone repro?

test.js

const Bluebird = require('/bluebird');
Bluebird.resolve(1).timeout(200);
node test.js

works fine

Owner

petkaantonov commented Oct 29, 2015

Can you give a standalone repro?

test.js

const Bluebird = require('/bluebird');
Bluebird.resolve(1).timeout(200);
node test.js

works fine

@assaf

This comment has been minimized.

Show comment
Hide comment
@assaf

assaf commented Oct 29, 2015

Thanks!

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