fix(PDiskPage): fix error boundary on failed restart#2069
Merged
artemmufazalov merged 1 commit intomainfrom Mar 31, 2025
Merged
fix(PDiskPage): fix error boundary on failed restart#2069artemmufazalov merged 1 commit intomainfrom
artemmufazalov merged 1 commit intomainfrom
Conversation
64b758b to
505bcdc
Compare
artemmufazalov
commented
Mar 31, 2025
Comment on lines
-3
to
-6
| // TODO: extend with other error types | ||
| type ResponseErrorData = TIssueMessage; | ||
|
|
||
| export interface IResponseError<T = ResponseErrorData> { |
Member
Author
There was a problem hiding this comment.
data is unknown, but this type prevented ts errors in our code, where we used this error.
Made data unknown, added proper type guards and some tests for them
505bcdc to
df83060
Compare
df83060 to
8ea5ba4
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the error boundary handling on failed restarts by refactoring how response errors are detected and parsed. Key changes include:
- Adding new utility functions (isResponseError, isResponseErrorWithIssues, isIssue, isIssuesArray) to standardize error checking.
- Updating error message handling in errors and UI components by leveraging the new response error detection.
- Adjusting type definitions for response errors.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/response.ts | Introduces new functions for error identification and parsing related to API errors |
| src/utils/errors/index.ts | Updates error message extraction using the new error checking utilities |
| src/utils/test/response.test.ts | Adds tests to validate the new error detection and parsing functions |
| src/types/api/error.ts | Changes the default generic type in IResponseError |
| src/containers/Tenant/Query/utils/isQueryCancelledError.ts | Removes the local duplicate isResponseError function |
| src/components/CriticalActionDialog/CriticalActionDialog.tsx | Updates error parsing logic for critical action dialogs using the new utilities |
Comments suppressed due to low confidence (2)
src/utils/response.ts:74
- [nitpick] Consider using an explicit comparison, e.g. 'arr.length > 0', for clarity instead of relying on the truthy value of 'arr.length'.
return Boolean(Array.isArray(arr) && arr.length && arr.every(isIssue));
src/types/api/error.ts:1
- The default generic type for IResponseError has been changed from a specific type to 'unknown'; please confirm this is intentional and update any related documentation if needed.
export interface IResponseError<T = unknown> {
Raubzeug
approved these changes
Mar 31, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #2068
CI Results
Test Status:⚠️ FLAKY
📊 Full Report
😟 No changes in tests. 😕
Bundle Size: ✅
Current: 83.25 MB | Main: 83.25 MB
Diff: +3.40 KB (0.00%)
✅ Bundle size unchanged.
ℹ️ CI Information