-
Notifications
You must be signed in to change notification settings - Fork 4
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
Error handling for OG #561
Conversation
- Create a ogApi axiosInstance - To manage 404 errors - set the authorisation headers - create handleOG_APIError to handle unknown errors - create the retryOG_APIErrors to hanlde retries - refactor all of the files in api directory to use ogApi
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #561 +/- ##
===========================================
- Coverage 97.86% 97.64% -0.22%
===========================================
Files 94 97 +3
Lines 12531 12463 -68
Branches 2025 2043 +18
===========================================
- Hits 12263 12170 -93
- Misses 266 291 +25
Partials 2 2 ☔ View full report in Codecov by Sentry. |
1c543c8
to
cb3474d
Compare
- minor styling changes to make dialogs mutation dialogs similar
a84961f
to
d33f462
Compare
d8234f5
to
0f1bd34
Compare
- This test was failing due to the "PREFERRED_COLOUR_MAP_PREFERENCE_NAME" being imported from the MSW handlers. This meant that the imports in the settingsMenuItems had been called before the test started running. Vitest doesn't allow you to mock an import if it is called before the test file as it is already cached. - The solution was to move the "PREFERRED_COLOUR_MAP_PREFERENCE_NAME" variable to the app.types.tsx
0f1bd34
to
47d7788
Compare
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.
Seems to be working well, I was able to trigger some errors using a mocking extension and it correctly caused SG to either display error toasts or prompt a token revalidation. Just a couple minor comments :)
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.
LGTM 👍
Description
Reasoning
Implement the same method as IMS.
multiple queries or mutations are called
Retries are set to 3 attempts and it doesn't retry for 403 request as that is handle in the interceptors
Global error handler function set in the App.tsx handles any other errors
Reduces the amount code as the authorization header and api url are now set in the axios instance
Works well with the auto-refresh functionality currently implemented, as the automatic refresh is set to 1 minute.
Testing instructions
Agile board tracking
closes DSEGOG-359