Skip to content

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

@assaf

Description

@assaf
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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions