bito-code-review[bot] commented on code in PR #44585:
URL: https://github.com/apache/superset/pull/44585#discussion_r4087711327
##########
superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx:
##########
@@ -405,14 +405,24 @@ const FilterValue: FC<FilterValueProps> = ({
);
if (error) {
+ // Errors without a registered `error_type` (e.g. a raw database error) are
+ // rendered by the fallback, so surface their message rather than assuming
+ // a network failure.
+ const errorMessage =
+ error.errors?.[0]?.message || error.error || error.message;
return (
<ErrorMessageWithStackTrace
error={error.errors?.[0]}
compact
fallback={
<ErrorAlert
- errorType={t('Network error')}
- message={t('Network error while attempting to fetch resource')}
+ errorType={
+ errorMessage ? t('Cannot load filter') : t('Network error')
+ }
+ message={
+ errorMessage ||
+ t('Network error while attempting to fetch resource')
+ }
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Network fallback unreachable</b></div>
<div id="fix">
On a real network failure `getClientErrorObject` resolves `{ error:
t('Network error') }` (getClientErrorObject.ts:193-200), so `errorMessage` is
truthy and the fallback `t('Network error while attempting to fetch resource')`
is unreachable — the alert now shows the terse 'Network error'. The new test
mocks `{ error: '' }`, which never occurs for network errors, so it passes
while production differs. Consider treating the generic network-error value as
'no message'.
</div>
</div>
<small><i>Code Review Run #50386e</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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]