Fix: Improve error handling for Glances widgets #3657
Merged
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.
Proposed change
I have the Glances widgets deployed in my Homepage instance and noticed that when a host is unreachable the widgets do not handle the errors as the other widgets do. It results in an ugly error message which doesn't respect either the global or service-level
hideErrors
. Here is an example from my deployment:I have rewritten parts of the components such that the
Error
component is no longer needed, as it is now implemented within theContainer
component. The service and error attributes are now passed into theContainer
component, such that the service-levelhideErrors
flag can be checked. Additionally, the global settings are now imported into theContainer
component so the globalhideErrors
flag can be checked. Within each component, if the service data containers an "error" key, the widget will now display an error message in line with other widgets. See the screenshot below:Additionally, see the below screenshot testing the service-level
hideErrors
flag set totrue
for one widget:Type of change
Checklist: