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

   <!-- Bito Reply -->
   The flagged issue is correct. The current implementation of 
`getFirstValidationError` only inspects the first value in the `message` 
object, which causes it to return `undefined` (and subsequently the generic 
'Invalid input' fallback) if the first field contains an unsupported structure, 
even if subsequent fields contain valid error strings.
   
   To resolve this, `getFirstValidationError` should iterate through all values 
in the `message` object until it finds a supported error message (a string or 
an array containing a string).
   
   
**superset-frontend/packages/superset-ui-core/src/query/getClientErrorObject.ts**
   ```
   function getFirstValidationError(message: JsonObject): string | undefined {
     for (const value of Object.values(message)) {
       if (typeof value === 'string') {
         return value;
       }
       if (Array.isArray(value)) {
         const firstString = value.find((item): item is string => typeof item 
=== 'string');
         if (firstString) return firstString;
       }
     }
     return undefined;
   }
   ```


-- 
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