Skip to content

IDEA. consider using PromiseLike interface instead of Promise class #7

@snytkine

Description

@snytkine

This means that there will not be a .catch usage anywhere. Instead, the .then will accept a second function to handle error.
This way a middleware can have 2 functions: doFilter like it does not and onError(e: any) => Promise

One benefit is that errorFormatter becomes just a middleware instead of a function that goes inside .catch at the end.
Another benefit is that a middleware may exist somewhere in the middle of promise chain and be able to recover from error.

Another benefit is ability to switch to different Promise provider like BlueBird

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