Skip to content

Handling errors #152

Description

@N1ark

I've been using the plugin, and noticed that it doesn't seem possible to properly catch errors thrown within the source async function to allow for a graceful exit with this.error if something goes wrong. No error message is printed either, and calling this.error inside the async function doesn't work either.

Is there something I missed?

Example code:

try {
  await inquirer
    .prompt([
      {
        type: "autocomplete",
        name: "test",
        message: "Will quit",
        source: async () => { throw Error() },
      },
    ])
    .catch(() => console.log("This is never printed"));
} finally {
  console.log("This is never printed");
}

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