-
Notifications
You must be signed in to change notification settings - Fork 17
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
chore: move analytics error handling in the plugin component #3335
base: master
Are you sure you want to change the base?
Conversation
So the same error screens are shown in both dashboard and DV app.
🚀 Deployed on https://pr-3335.data-visualizer.netlify.dhis2.org |
DIMENSION_ID_DATA | ||
]?.every( | ||
(dim) => | ||
response.metaData.items[dim]?.valueType === |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On line 227 you check defined for both response
and metadata
. Any need to do that here as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was existing code moved from the Visualization
component.
231 makes sure there is dim
in the items
object before reading valueType
, it seems better to leave this check.
response
and metaData
are not checked again here.
Now the VisualizationErrorInfo component is used also outside the StartScreen component.
This happens when a layout error is thrown before the plugin is rendered. Without this, the error is shown briefly before the VisualizationPlugin is rendered and might crash due to other uncaught errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is an excellent idea and have added a comment to perhaps improve it even further.
|
Key features
Description
DV has a number of custom error screens where a user friendly error is shown to the user.
The
errorCode
returned in the analytics response is used to choose the error screen to show.This error handling was done in the DV app components before, an
onError
callback was passed to the plugin component and used to pass the error back to the app.Dashboard app also used the
onError
callback, but it didn't have all the custom error screen so a generic error was shown instead where the original error string from the analytics api was shown.This error string is often obscure for the end user, and can also contain ids and other information intended more for admins or developers for debugging purposes.
When an error occured in a plugin, and the visualization was opened in the DV app, a different error was shown.
By moving the error handling in the plugin component, the same custom error screens are used in both the DV and dashboard apps.
TODO
Screenshots
Before, no custom screen for E7120 in DV (already used in LL):
![Screenshot 2025-02-05 at 15 52 36](https://private-user-images.githubusercontent.com/150978/410044446-57517d5c-3e30-4df6-9ab2-f343c4428aeb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1MDQxMjcsIm5iZiI6MTczOTUwMzgyNywicGF0aCI6Ii8xNTA5NzgvNDEwMDQ0NDQ2LTU3NTE3ZDVjLTNlMzAtNGRmNi05YWIyLWYzNDNjNDQyOGFlYi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNFQwMzMwMjdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yOWQ0MGZmMDI4MDg3ZjY0MTJiZDgzZDU2MWMzMDFhYzBjNmRmMzgyMWVkZjE1NzhmY2Q1MDEwYzllMTQ2NzIzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.S9HAvnrSuyWamg0u98uIHuGgKw8ASD06uvwUjczopC0)
After, new custom error for E7120 (same text as in LL):
![Screenshot 2025-02-05 at 15 52 53](https://private-user-images.githubusercontent.com/150978/410044594-8c92a741-5195-48c1-8ef2-f4b2c11f462a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1MDQxMjcsIm5iZiI6MTczOTUwMzgyNywicGF0aCI6Ii8xNTA5NzgvNDEwMDQ0NTk0LThjOTJhNzQxLTUxOTUtNDhjMS04ZWYyLWY0YjJjMTFmNDYyYS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNFQwMzMwMjdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1jMWM4YTZjNjIxNDhhNDk0Y2Q0MTU2M2FkM2U0ZjZhZWZjNjlhMzA0NWJkOTg0MDM2ZTMyZGM5NmVkOTAzMzIwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.dNHucwtWOMona7DavhfzHbjlWdGpttbhD0asssnkulg)
Same error screen used in dashboard app:
![Screenshot 2025-02-05 at 15 52 59](https://private-user-images.githubusercontent.com/150978/410044665-d92a1d8b-5363-44fc-9dd7-82b50779105e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1MDQxMjcsIm5iZiI6MTczOTUwMzgyNywicGF0aCI6Ii8xNTA5NzgvNDEwMDQ0NjY1LWQ5MmExZDhiLTUzNjMtNDRmYy05ZGQ3LTgyYjUwNzc5MTA1ZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNFQwMzMwMjdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05YTYxZDQwY2ZiMjJiMjEwYjQxOTgxMWExNGZkODQ3ODAwN2M0ZGZkOWM1ZmM3NWY5MDk2NTJmMGZhODU5NzRkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.gQW8HdDLqeYdxuCwXvCi_N4e6l16bz6xZTGMgu7mxAo)