Skip to content

Prefer calling then and catch separately to combining them into a single then #217

Closed
@ghost

Description

Essentially, Promise.prototype.then allows taking in two arguments to respond to both resolved and rejected promises. Essentially, p.then(f, g) is equivalent to p.catch(g).then(f); note that the catch comes first since errors thrown by the then handler are not caught by the catch handler.

It would be nice to automatically replace instances like this since it makes it easier to visually scan for catch to check if an error is handled. It also helps emphasise the fact that the then is not handled by the catch, which isn't as apparent when it's ordered visually after the then handler.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions