apache / apache/cordova-lib

Audit Promise return values

Open
#714 2 comments 2 reactions 0 assignees View on GitHub
enhancement hacktoberfest
Dominant language
JavaScript
Stars
231
Forks
242
Avg merge
2h 51m
Merged PRs (30d)
7

Description

There are too many places where we have very inconsistent return types involving promises. Particularly cases where functions throw, return a resolving promise, and also return a rejecting promise. Also a lot of places where functions return promises that resolve with different value types in different paths.

HookRunner is one spot I've seen that's particularly bad for this, but I've seen it in a few other spots too.

My general recommendation:
* Any function that returns a promise should never throw. It should reject the promise.
* Any function that returns a promise should document the resolving value type of that promise, and ensure that only that value type is ever resolved.

Contributor guide

Open the contributing guide

Research direction

Start with HookRunner, the specifically named problem area, then inventory the other promise-returning functions described in the issue. Done means promise-returning functions reject instead of throw, and each documents and consistently resolves one value type.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.