-
Notifications
You must be signed in to change notification settings - Fork 465
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
Enhance error handling for UI sendRequest service #14971
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #14971 +/- ##
==========================================
- Coverage 58.85% 58.81% -0.04%
==========================================
Files 953 954 +1
Lines 80237 80303 +66
Branches 2222 2251 +29
==========================================
+ Hits 47220 47227 +7
- Misses 29340 29399 +59
Partials 3677 3677
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
renderFlash( | ||
"error", | ||
enable | ||
? "Couldn't turn on Windows MDM. Please configure Fleet with a certificate and key pair first." |
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.
Just curious, does that mean the server's message is not used? So if the copy was to be changed, it would need to be changed in both backend and frontend?
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.
As currently implement, yes, although I may have misunderstood the discussion thread. Has this message also been implemented on the backend?
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.
It is, returned as per the "standard" error message payload returned when there's a 422 response (I'm pretty sure we do extract those kinds of server-sent error messages elsewhere in the frontend?): https://github.com/fleetdm/fleet/pull/14858/files#diff-ff669b9f96ea80679f4651e9cf45ded57d5cd939d1e4e24977eb72d37d71e8bcR733
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.
Thanks! I'll tweak this a bit to extract the error message.
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.
Pending resolution of @mna's considerations
frontend/services/index.ts
Outdated
@@ -12,7 +12,8 @@ const sendRequest = async ( | |||
path: string, | |||
data?: unknown, | |||
responseType: AxiosResponseType = "json", | |||
timeout?: number | |||
timeout?: number, | |||
includeFullAxiosError?: boolean |
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.
Nice. Any particular reason for this or just to add flexibility and observability to the error handling pattern?
275094a
Issue #14446
Checklist for submitter