Skip to content

lib: callbacks firing twice if first attempt throws #58419

Open
@LiviaMedeiros

Description

@LiviaMedeiros

There are a few places where code flows like this:

try {
  // some code that produces `result` and can potentially throw
  callback(null, result); // no error, return result
} catch(error) {
  callback(error);
}

These are usually (if not always) bugs, because it wraps the callback call itself in the try block, and if that callback throws, it gets caught and called again, but this time with its own error.

For example:

Some of these bugs might be a good first issue Issues that are suitable for first-time contributors. candidates.

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