Skip to content

isCancelled() is false after calling cancel() #1187

@ben-page

Description

@ben-page
  1. What version of bluebird is the issue happening on? 3.4.1

  2. What platform and version? (For example Node.js 0.12 or Google Chrome 32) Node.js 6.3.1

  3. Did this issue happen with earlier version of bluebird? Yes

Description

Based on the examples in the docs, one would expect isCancelled() to be false after cancellation but this does not seem to be the case.

Example

const Promise = require('bluebird');
Promise.config({
    cancellation: true
});

setTimeout(() => {
    cancellablePromise.cancel();
    console.log('1. isCancelled = ' + cancellablePromise.isCancelled());
}, 100);

const cancellablePromise = Promise.delay(300)
    .finally(() => {
        console.log('2. isCancelled = ' + cancellablePromise.isCancelled());
    });

console.log('isCancellable = ' + cancellablePromise.isCancellable());

cancellablePromise
    .finally(() => {
        console.log('3. isCancelled = ' + cancellablePromise.isCancelled());
    });

Output

isCancellable = true
1. isCancelled = false
2. isCancelled = false
3. isCancelled = true

Is this the intended behavior or are the docs wrong?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions