Skip to content
This repository was archived by the owner on Sep 6, 2025. It is now read-only.
This repository was archived by the owner on Sep 6, 2025. It is now read-only.

Detect swallowed errors when re-throwing in Promise catch handlers #24

@Amnish04

Description

@Amnish04

Currently, we only look for swallowed errors in synchronous operations within catch blocks.

We need to extend the no-swallowed-error-cause rule to handle cases where a new error is being thrown in catch handlers of promises.

Here's an example:

new Promise((resolve, reject) => {
    throw new Error("Failing because...");
}).catch((error) => {
    // `error` is getting swallowed
    throw new Error("Something went wrong");
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions