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

🐛: Reject layoutCallback promise when throw #15410

Merged
merged 3 commits into from
May 18, 2018

Conversation

zhouyx
Copy link
Contributor

@zhouyx zhouyx commented May 17, 2018

Throwing error synchronously breaks #layoutCallback, because it won't return a promise. And the handler for promise reject will never run.

this.classList.add('i-amphtml-layout');

let promise;
try {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use:

export function tryResolve(fn) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@zhouyx
Copy link
Contributor Author

zhouyx commented May 17, 2018

cc @jridgewell

Copy link
Contributor

@jridgewell jridgewell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

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.

4 participants