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

🐛 Change to using setTimeout to avoid muted unhandledrejections #25342

Merged
merged 1 commit into from
Oct 31, 2019

Conversation

jridgewell
Copy link
Contributor

It also directly calls into the globally installed error reporting function.

Re: #25289

It seems HTML spec is unlikely to change: whatwg/html#5051

It also directly calls into the globally installed error reporting function.

Re: ampproject#25289

It seems HTML spec is unlikely to change: whatwg/html#5051
@@ -106,7 +106,8 @@ function isPatched(win) {
* @param {!Error} error
*/
function rethrowAsync(error) {
new /*OK*/ Promise(() => {
setTimeout(() => {
self.__AMP_REPORT_ERROR(error);

Choose a reason for hiding this comment

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

Do we know for sure that setReportError() will be called by this point?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this can't happen until an AMP element has been created, which happens after the log reporter is setup.

@jridgewell jridgewell merged commit 467ca77 into ampproject:master Oct 31, 2019
@jridgewell jridgewell deleted the ce-rethrow branch October 31, 2019 21:10
@dreamofabear
Copy link

Hm, this might be causing local and PR test failures for me:

willchou$ gulp unit --files=test/unit/test-custom-element-registry.js --watch --nobuild

...

SUMMARY:
● 5 tests completed
● 3 tests failed

FAILED TESTS:
  CustomElement register
    ● "after each" hook
      Chrome 78.0.3904 (Mac OS X 10.14.6)
    Error: Uncaught Error: The element did not specify a layout attribute. Check https://amp.dev/documentation/guides-and-tutorials/develop/style_and_layout/control_layout and the respective element documentation for details.​​​ (/Users/willchou/amphtml/src/polyfills/custom-elements.js:111:5 <- /var/folders/sl/26jtyj5959n8_bn8mj_s05cr006wch/T/79f5127f8ea2f7051db4edebf9d5f61d.browserify.js:44000)

    ● "after each" hook in "CustomElement register"
      Chrome 78.0.3904 (Mac OS X 10.14.6)
    TypeError: Cannot read property 'call' of undefined

  ● "before each" hook in "{root}"
    Chrome 78.0.3904 (Mac OS X 10.14.6)
  TypeError: Cannot read property 'fullTitle' of undefined
      at Context.<anonymous> (Users/willchou/amphtml/test/_init_tests.js:402:31)

https://travis-ci.org/ampproject/amphtml/jobs/605784224

@dreamofabear
Copy link

16bf905 seems to fix it.

@dreamofabear
Copy link

*fixed one instance. Tracking down these async connectedCallback errors looks like whack-a-mole, but it's not obvious which tests are causing them.

Can't cleanly check for "test mode" here, so maybe we can store these errors somewhere and throw them periodically instead?

@dreamofabear
Copy link

Merged master and the test failures are no longer happening on my PR #25066. 🤷‍♂

micajuine-ho pushed a commit to micajuine-ho/amphtml that referenced this pull request Dec 27, 2019
…ject#25342)

It also directly calls into the globally installed error reporting function.

Re: ampproject#25289

It seems HTML spec is unlikely to change: whatwg/html#5051
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