Skip to content

[Bug] Async hook doesn't catch error when reject a falsy value #176

Open
@peakchen90

Description

@peakchen90

Hi, I seem to have found a bug:

Environment

  • Tapable: v2.2.1
  • Node: v16.16.0
  • OS: MacOS 12.5

Case

const { AsyncSeriesHook } = require('tapable');

const hook = new AsyncSeriesHook();
hook.tapPromise('A', () => {
  return Promise.reject(0); // reject a falsy value
});
hook.tapPromise('B', () => {
  console.log('some thing');
});

hook.callAsync((err) => {
  if (err) {
    console.error('Error:', err);
  } else {
    console.log('Success');
  }
});

Expected output: Error: 0

But the actual output: Success

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions