dosubot[bot] commented on issue #33500:
URL: https://github.com/apache/superset/issues/33500#issuecomment-2887926880

   <!-- Greeting -->
   Hello @timfursov! I'm [Dosu](https://dosu.dev), your friendly bot here to 
help you tackle bugs, answer questions, and explore contributions while you 
wait for a human maintainer. Let’s get this sorted out! 🎉
   
   <!-- Answer -->
   To address the issue where an error message containing HTML tags results in 
"Unexpected error Bad request" instead of displaying the actual error message 
in Apache Superset, you can follow these steps:
   
   1. **Use the ErrorBoundary Component**: Ensure your chart component is 
wrapped with the `ErrorBoundary` component. This component is designed to catch 
errors and handle them gracefully.
   
   2. **Set the showMessage Prop**: Configure the `ErrorBoundary` component 
with the `showMessage` prop set to `true`. This ensures that error messages are 
displayed.
   
   3. **Custom Error Handling**: Implement a custom `onError` function within 
the `ErrorBoundary` to log errors or perform additional handling as needed.
   
   4. **Parse Error Messages Correctly**: Verify that the error parsing logic 
in `getClientErrorObject` correctly handles HTML content. The function 
`parseErrorJson` checks for HTML in error messages and retrieves the 
appropriate message using `retrieveErrorMessage`. Ensure this logic is 
correctly implemented and tested.
   
   5. **Test Error Handling**: Make sure your error handling logic is 
thoroughly tested, as demonstrated in the `ErrorBoundary.test.tsx` file. This 
includes verifying that the error message is displayed when `showMessage` is 
set to `true` 
<sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-core/test/query/getClientErrorObject.test.ts)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.tsx)</sup><sup>[[3]](https://github.com/apache/superset/blob/master/superset-frontend/src/components/ErrorBoundary/ErrorBoundary.test.tsx)</sup><sup>[[4]](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-core/src/query/getClientErrorObject.ts)</sup>.
   
   By following these steps, you can ensure that error messages, including 
those with HTML tags, are displayed correctly and informatively, rather than 
defaulting to a generic "Unexpected error Bad request".
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   
   ---
   <sup>Help Dosu learn! Give it feedback: [Great 
Response](https://app.dosu.dev/response-feedback/25d008e4-1d7e-4bbf-8571-28ea647e95f6?feedback_type=great_response)
 | [Irrelevant 
Answer](https://app.dosu.dev/response-feedback/25d008e4-1d7e-4bbf-8571-28ea647e95f6?feedback_type=irrelevant_answer)
 | [Incorrect 
Sources](https://app.dosu.dev/response-feedback/25d008e4-1d7e-4bbf-8571-28ea647e95f6?feedback_type=incorrect_sources)
 | [Too 
Verbose](https://app.dosu.dev/response-feedback/25d008e4-1d7e-4bbf-8571-28ea647e95f6?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/25d008e4-1d7e-4bbf-8571-28ea647e95f6?feedback_type=hallucination)
 | [Bug 
Report](https://app.dosu.dev/response-feedback/25d008e4-1d7e-4bbf-8571-28ea647e95f6?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/25d008e4-1d7e-4bbf-8571-28ea647e95f6?feedback_type=other)</sup>
   


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