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

   <!-- Bito Reply -->
   Refactoring the thunk to use `getErrorText` is the recommended approach to 
ensure consistency and prevent regressions. Duplicating the error mapping logic 
in `dashboardState.ts` creates a maintenance burden where changes to 
`getErrorText` might not be reflected in the thunk. By centralizing this logic, 
you ensure that both the test and the production code rely on the same source 
of truth for error handling.
   
   
**superset-frontend/packages/superset-ui-core/test/query/getClientErrorObject.test.ts**
   ```
   test('getErrorText for a non-JSON 403 response', async () => {
     // ... (test setup)
     expect(await getErrorText(proxyForbidden, 'dashboard')).toEqual(
       'Sorry, there was an error saving this dashboard: Forbidden',
     );
   
     const supersetForbidden = new Response(
       JSON.stringify({ message: 'Forbidden' }),
       { status: 403, statusText: 'FORBIDDEN' },
     );
     expect(await getErrorText(supersetForbidden, 'dashboard')).toEqual(
       'You do not have permission to edit this dashboard',
     );
   });
   ```


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