You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Any function that returns a promise should never throw. It should reject the promise.
To clarify: It's OK if throw statements are used in async functions or inside Promise callbacks, because in these cases the Exceptions will be converted into Promise rejections.
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:
The text was updated successfully, but these errors were encountered: