amp-script: improved error messages#29841
Merged
samouri merged 10 commits intoampproject:masterfrom Aug 25, 2020
Merged
Conversation
jridgewell
reviewed
Aug 17, 2020
553e3bf to
e357130
Compare
| } | ||
| }) | ||
| .catch((err) => { | ||
| // Catch errors if due to an issue with workerAndAuthorScripts rejection. |
There was a problem hiding this comment.
Can we just chain a catch() onto workerAndAuthorScripts above?
Member
Author
There was a problem hiding this comment.
WorkerDOM.upgrade returns a promise which is the uncaught one, so chaining onto workerAndAuthorScripts won't help.
The more obvious thing to do IMO would be to return the WorkerDOM.upgrade promise instead of workerAndAuthorScripts down below. Current method seems very intentional though, is there a reason why we don't do it?
There was a problem hiding this comment.
Oh let's just do that. Don't think so.
dreamofabear
approved these changes
Aug 20, 2020
jridgewell
approved these changes
Aug 24, 2020
ed-bird
pushed a commit
to ed-bird/amphtml
that referenced
this pull request
Dec 10, 2020
* amp-script: improved error messages * remove double error caused by WorkerDOM.upgrade * need an extra space * lint * eh, back to createError * less brittle check for script failure * keep nonnull return promise * cleanest way yay * "or incorrect?" * fix test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #29614
For the reviewer: adding a
.catchtoWorkerDOM.upgradewas hacky. If an error occurs within the worker-dom code, we'd probably want an uncaught exception to throw, whereas if it is caused by the code to retrieve authorScript, then we don't want that.The cleanest way of having the same effect would be to have the entire upgrade path within a
.then()callback of the scripts, although that would then delay the start of the upgrade until after they've resolved (not that I think worker-dom actually does much work before they do, but it is what caused my hesitation).