-
Notifications
You must be signed in to change notification settings - Fork 153
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
Display MySQL user defined error in API Key UI #4590
Display MySQL user defined error in API Key UI #4590
Conversation
Signed-off-by: Kenta Kozuka <[email protected]>
dispatch(addToast({ message: GENERATE_API_KEY_SUCCESS })); | ||
}); | ||
dispatch(generateAPIKey(values)) | ||
.then(unwrapResult) |
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.
Fixes an existing bug that success toast is displayed even if a request fails.
Signed-off-by: Kenta Kozuka <[email protected]>
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #4590 +/- ##
==========================================
+ Coverage 29.95% 29.98% +0.03%
==========================================
Files 220 220
Lines 25933 25948 +15
==========================================
+ Hits 7767 7781 +14
Misses 17518 17518
- Partials 648 649 +1
☔ View full report in Codecov by Sentry. |
} | ||
if errors.Is(err, datastore.ErrUserDefined) { |
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.
Why do we have to change from switch case to multiple if 🤔
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.
If we generate an error with a message from MySQL, handling errors with a switch cannot work properly. That's why I had to change it to multi-if blocks.
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.
Which means the switch block can not check the type of datastore.ErrUserDefined error 🤔 It's a bit weird to me. Btw, how about adding test for this function. Looks like this function is testable without mocking anything.
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.
When an error message from MySQL is added to datastore.ErrUserDefined, checking with the switch block does not work because the new error is no longer the same as datastore.ErrUserDefined.
I agree with you to add tests for it 👍
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.
Added tests.
Signed-off-by: Kenta Kozuka <[email protected]>
Signed-off-by: Kenta Kozuka <[email protected]>
@khanhtc1202 Added tests 👍 |
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.
Great 🚀
* Display MySQL user defined error in UI Signed-off-by: Kenta Kozuka <[email protected]> * Fix Unexpected empty arrow function Signed-off-by: Kenta Kozuka <[email protected]> * Add tests Signed-off-by: Kenta Kozuka <[email protected]> * Run subtests in parallel Signed-off-by: Kenta Kozuka <[email protected]> --------- Signed-off-by: Kenta Kozuka <[email protected]>
* Display MySQL user defined error in API Key UI (#4590) * Display MySQL user defined error in UI Signed-off-by: Kenta Kozuka <[email protected]> * Fix Unexpected empty arrow function Signed-off-by: Kenta Kozuka <[email protected]> * Add tests Signed-off-by: Kenta Kozuka <[email protected]> * Run subtests in parallel Signed-off-by: Kenta Kozuka <[email protected]> --------- Signed-off-by: Kenta Kozuka <[email protected]> * Display MySQL user defined error of piped, command, and application (#4597) Signed-off-by: Kenta Kozuka <[email protected]> * Add service tags as takset task on create (#4598) Signed-off-by: khanhtc1202 <[email protected]> * [ECS] Fix remove all previous active tasksets on QuickSync (#4600) * Remove previous ACTIVE tasksets if present on quicksync Signed-off-by: khanhtc1202 <[email protected]> * Remove GetPrimaryTaskSet interface Signed-off-by: khanhtc1202 <[email protected]> --------- Signed-off-by: khanhtc1202 <[email protected]> * Fix unable to fetch ECS taskset tags (#4605) Signed-off-by: khanhtc1202 <[email protected]> * Support recreate for ECS tasks (#4608) * Support singleton ECS task Signed-off-by: khanhtc1202 <[email protected]> * Rename singleton to recreate Signed-off-by: khanhtc1202 <[email protected]> --------- Signed-off-by: khanhtc1202 <[email protected]> --------- Signed-off-by: Kenta Kozuka <[email protected]> Signed-off-by: khanhtc1202 <[email protected]> Co-authored-by: Kenta Kozuka <[email protected]>
* Display MySQL user defined error in UI Signed-off-by: Kenta Kozuka <[email protected]> * Fix Unexpected empty arrow function Signed-off-by: Kenta Kozuka <[email protected]> * Add tests Signed-off-by: Kenta Kozuka <[email protected]> * Run subtests in parallel Signed-off-by: Kenta Kozuka <[email protected]> --------- Signed-off-by: Kenta Kozuka <[email protected]> Signed-off-by: moko-poi <[email protected]>
* Display MySQL user defined error in UI Signed-off-by: Kenta Kozuka <[email protected]> * Fix Unexpected empty arrow function Signed-off-by: Kenta Kozuka <[email protected]> * Add tests Signed-off-by: Kenta Kozuka <[email protected]> * Run subtests in parallel Signed-off-by: Kenta Kozuka <[email protected]> --------- Signed-off-by: Kenta Kozuka <[email protected]>
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes partof #4589
Does this PR introduce a user-facing change?: