Skip to content

returning Promise.reject in async function results in Unhandled rejection error message #1404

Closed
@comtaler

Description

@comtaler
  1. What version of bluebird is the issue happening on?
    3.5.0

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

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

When returning Promise.reject in async function, an error is printed on the console "Unhandled rejection" even the promise is caught. It doesn't print out the error if native Promise is used.

const Promise = require("bluebird");

async function WaitAsync(){
    return Promise.reject(new Error("reject"));
}

Promise.resolve().then(() => {
    return WaitAsync();
}).catch(err => {
    console.log("caught: ", err);
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions