bito-code-review[bot] commented on PR #42581:
URL: https://github.com/apache/superset/pull/42581#issuecomment-5126444506

   <!-- Bito Reply -->
   The flagged issue is correct. The current implementation relies on 
`clientError.error` as a fallback, which can be undefined if 
`getClientErrorObject` returns a response without an explicit error field 
(e.g., network failures or non-JSON responses). 
   
   To resolve this, you should update the error handling logic to prioritize 
`clientError.message` or `clientError.statusText` and provide a localized 
fallback string, similar to how CRUD error handling is implemented elsewhere in 
the codebase. 
   
   Here is a concise fix for the error handling block in 
`superset-frontend/src/features/datasets/AddDataset/DatasetPanel/index.tsx`:
   
   ```tsx
   const parsedError = clientError.errors?.[0] ?? {
     error_type: ErrorTypeEnum.GENERIC_BACKEND_ERROR,
     extra: null,
     level: 'error' as const,
     message: clientError.message || clientError.statusText || t('An unexpected 
error occurred'),
   };
   ```
   
   Would you like me to fetch all other comments on this PR to validate and 
implement fixes for them as well?
   
   **superset-frontend/src/features/datasets/AddDataset/DatasetPanel/index.tsx**
   ```
   const parsedError = clientError.errors?.[0] ?? {
     error_type: ErrorTypeEnum.GENERIC_BACKEND_ERROR,
     extra: null,
     level: 'error' as const,
     message: clientError.message || clientError.statusText || t('An unexpected 
error occurred'),
   };
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to