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

Simulate uncaught promise rejections #12250

Closed
kumar303 opened this issue Aug 23, 2018 · 3 comments
Closed

Simulate uncaught promise rejections #12250

kumar303 opened this issue Aug 23, 2018 · 3 comments
Labels
qa:not_needed repository:addons-frontend Issue relating to addons-frontend state:stale Issues marked as stale. These can be re-opened should there be plans to fix them.

Comments

@kumar303
Copy link
Contributor

kumar303 commented Aug 23, 2018

We are currently running Node 8 where uncaught promise rejections show a warning. The process keeps running. In Node 11, uncaught promise rejections will cause the Node process to exit (see nodejs/node#20392).

We should add an error-simulation view to simulate this.

@willdurand
Copy link
Member

We can probably listen to these events:

and log the error (highest level) + exiting properly.

@kumar303
Copy link
Contributor Author

For the simulation, we just need to trigger it. It's probably as easy as:

diff --git a/src/core/components/error-simulation/SimulateAsyncError/index.js b/src/core/components/error-simulation/SimulateAsyncError/index.js
index 7c8c792f3..21bd2aecc 100644
--- a/src/core/components/error-simulation/SimulateAsyncError/index.js
+++ b/src/core/components/error-simulation/SimulateAsyncError/index.js
@@ -8,7 +8,10 @@ export class SimulateAsyncErrorBase extends React.Component {
   render() {
     log.info('Simulating an asynchronous error');
     setTimeout(() => {
-      throw new Error('This is a simulated asynchronous error');
+      const promise = new Promise();
+      promise.reject(
+        new Error('This is a simulation of an uncaught promise rejection'),
+      );
     }, 50);
     return <p>Asynchronous error simulated, check the logs</p>;
   }

(but in its own component, of course)

@stale
Copy link

stale bot commented Jan 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. If you think this bug should stay open, please comment on the issue with further details. Thank you for your contributions.

@stale stale bot added the state:stale Issues marked as stale. These can be re-opened should there be plans to fix them. label Jan 1, 2020
@stale stale bot closed this as completed Jan 15, 2020
@KevinMind KevinMind added migration:no-jira repository:addons-frontend Issue relating to addons-frontend labels May 5, 2024
@KevinMind KevinMind transferred this issue from mozilla/addons-frontend May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
qa:not_needed repository:addons-frontend Issue relating to addons-frontend state:stale Issues marked as stale. These can be re-opened should there be plans to fix them.
Projects
None yet
Development

No branches or pull requests

4 participants