Add Error Handling to `ModuleRecoveryAlert` and show error message to the user.
See original GitHub issueFeature Description
Currently, when one or more modules fails to recover for any reason, the backend spits out error(s) but we do not show it anywhere to the user and the failure happens silently. We should add the error message to the UI so users are not confused.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- In the
ModuleRecoveryAlertcomponent, when one or more modules fail to recover the error message(s) should be displayed. - The message(s) should be displayed above the Recover button as red text using the standard error color,
#d53e36. - When there is only a single module to recover which fails, the message format should be:
Error: {error message}
- When there are multiple module errors, the message format should be as follows:
The following modules failed to be recovered:
• {module name}: {API error message}
• {module name}: {API error message} - The errors should be cleared when Recover is pressed again.
Implementation Brief
- Move the
<ModuleRecoveryAlert />component to its own folder (making it easy to create sub-components). - Create an
<Error />component as a sub-component of<ModuleRecoveryAlert />which acceptsrecoverableModulesanderroras props. - In the
<ModuleRecoveryAlert />component:- Check the response of
recoverModulesand see if the response object contains anerrorobject. - If so, store the error object in a new component state named
error. - Clear this
errorstate whenhandleRecoverModulesis called (only if it is populated). - Only in cases where the current user can recover modules, i.e. the “Recover” button is visible, check if the
errorstate is populated and if so, show the new<Error />component just before the “Recover” button. - Pass the
recoverableModulesvariable as therecoverableModulesprop to the<Error />component. - Pass the
errorstate value as theerrorprop to the<Error />component.
- Check the response of
- In the
<Error />component:- Add the necessary JSX and styling to match the format mentioned in the AC.
- Use the value of the
errorprop to determine if there is one or multiple errors and use the appropriate format as depicted in the AC. - To get the
nameof the module (it is not mentioned in the error object, only the slug is provided), use therecoverableModulesprop object with the provided slug. - Make sure the errors are displayed in red text using the standard error color,
#d53e36.
Test Coverage
- No tests need to be added/updated.
QA Brief
- Ensure that the
dashboardSharingfeature flag is enabled in the tester plugin. - Go to the Site Kit Dashboard.
- Using the Dashboard Sharing settings modal, provide access to the “Administrator” role for all modules.
- With a private browser window, sign in to the site as another admin and authenticate your Google account with Site Kit.
- Disconnect the first admin from Site Kit.
- As the second admin, you should now be able to see the Module Recovery Alert with a list of modules that can be recovered.
- Now we need to simulate an error on recovering the modules. This can be done by turning your Wi-Fi or internet connection off after the Module Recovery Alert has loaded.
- Try to recover one and multiple modules and make sure the errors show up as described in the AC.
Changelog entry
- Update module recovery notification to display feedback for errors.
Issue Analytics
- State:
- Created a year ago
- Comments:7
Top Results From Across the Web
VBA Error Handling - A Complete Guide - Excel Macro Mastery
“Abort, Retry, Fail?” – MS-DOS error message circa 1986. This post provides a complete guide to VBA Error Handing. If you are looking...
Read more >Error Handling with Angular 8 - Tips and Best Practices - Rollbar
First, we will describe the traditional approaches using ErrorHandler and HttpClient . Then, we will show you a better solution using ...
Read more >Adding error handling to a client-side human service - IBM
You can add error handling to client-side human services so that integration services display error messages to users.
Read more >Error handling, "try...catch" - The Modern JavaScript Tutorial
So, try...catch can only handle errors that occur in valid code. Such errors are ... Here we use the catch block only to...
Read more >jQuery Ajax error handling, show custom exception messages
I will set the ajaxError handler and display the error on a div named ... use .fail() for error handling as .error() is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@wpdarren You’re right. After GM2+, the error styles have been updated globally and have been reflected here as well.
IB ✅