aminghadersohi commented on PR #42390:
URL: https://github.com/apache/superset/pull/42390#issuecomment-5145721233

   Good catch — you're right, and thanks for the precise diagnosis. Fixed in 
3547e7f.
   
   The regression was exactly as described: `queryApi.ts:67` sets `errors: 
errorObj?.errors || []`, so any error without a structured SIP-40 `errors[]` 
array (raw 500, HTML error page, timeout, `Failed to fetch`) yielded an 
`undefined` payload, and `ErrorMessageWithStackTrace` fell through to a bare 
`ErrorAlert` titled "Unexpected error" with an empty body.
   
   Applied your suggested guard:
   
   ```tsx
   const clientError = (metadataError || metadataExtrError) as 
ClientErrorObject;
   const errorPayload = clientError?.errors?.[0];
   return errorPayload ? (
     <ErrorMessageWithStackTrace error={errorPayload} source="crud" />
   ) : (
     <Alert type="warning" message={clientError?.error} />
   );
   ```
   
   This keeps `TablePreview` consistent with the other `source="crud"` 
consumers you pointed at (`TableExploreTree`, `DatabaseSelector`, 
`TableSelector`), preserves the OAuth2 authorization link + retry on the 
structured path, and restores the original message text on every other path.
   
   Also added a regression test — `renders the error message when metadata 
fails without a structured error` — that mocks a 500 with `{ message: ... }` 
and no `errors[]`, asserting the message still surfaces.
   
   One note on verification: I couldn't get a clean local Jest run in this 
worktree (the repo requires Node ^24.16.0, this box has v22, and `fetch-mock` 
fails to intercept — the pre-existing tests fail identically on an unmodified 
checkout, so it's environmental, not the change). I validated the fix by 
tracing `parseErrorJson` (a `{message}` body with no `errors[]`/`stack` sets 
`error.error = message`, leaving `errors: []`), plus `tsc --noEmit`, prettier 
and oxlint clean on the touched files. Relying on CI for the actual test signal.


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