Skip to content

Async method destructuring error not caught by Promise.catch after Babel transform #17250

@magic-akari

Description

@magic-akari

💻

  • Would you like to work on a fix?

How are you using Babel?

Programmatic API (babel.transform, babel.parse)

Input code

(new class {
  async foo(a, { b }) { }
})
  .foo()
  .catch(e => {
    console.log("caught");
  });

Configuration file name

No response

Configuration

{
  "plugins": ["transform-async-to-generator"]
}

Current and expected behavior

Expected behavior:

caught should be printed.

Current behavior:

throw error:

Uncaught TypeError: Cannot destructure property 'b' of 'undefined' as it is undefined.

Environment

N/A

Possible solution

No response

Additional context

Babel Playground

Metadata

Metadata

Assignees

No one assigned

    Labels

    i: needs triageoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions