Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ Use tryResolve instead of Promise.resolve with call #15143

Merged
merged 4 commits into from
May 8, 2018

Conversation

jridgewell
Copy link
Contributor

This moves all uses of Promise.resolve(FUNC()) to tryResolve(FUNC).

This both captures sync throwing errors, and resolves with the return value of the FUNC (which may be a async rejection promise). Either way, it allows handling of errors using a #catch block.

@jridgewell jridgewell merged commit ca101d0 into ampproject:master May 8, 2018
@jridgewell jridgewell deleted the promise-tryResolve branch May 8, 2018 04:24
noranazmy pushed a commit to noranazmy/amphtml that referenced this pull request May 10, 2018
)

* Move into utils/promise

* Move to using tryResolve

* Typecast

* Bump
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants