-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SIP-40] Proposal for Custom Error Messages #9194
Comments
@etr2460 The error code and
Can create a registry for renderers and use error code as
Could you add a few examples of the current error api result that are fragmented? |
@etr2460, this is great. It looks like a step towards getting all API responses to have a standard shape. One thing that I would change a tiny bit would be the response shape. Enums are awesome for this sort of thing, but one thing I would add would be an error "code" which would simply be an A slight variation to your structure:
|
One concern I had about moving this out into a Superset error package was that I don't think strings for default error messages would get translated in those packages. That seemed like a non-starter to me, so I didn't consider it. If you have a way to resolve this, then I'd be happy to hear it! For examples of fragmented error handling, in SQL Lab we render alerts based on error messages injected inside the query object (as well as the poorly defined I totally agree with an One thing I don't agree with is using an error code as opposed to an enum. This is for two reasons:
|
Makes sense. I think one nice thing about the int is that it augments the status code and can be grouped in much the same way as HTTP statues, i.e. [10000,11000) are for error class A, and [11000,12000) are for class B, etc.. I can see what you're saying from the point of view of improving the readability of the errors based on code. Seems fine either way :) |
@etr2460 Got it. Also to keep the scope actionable, I agree with modifying the code inside superset as a start. You can still leverage the |
I love it! Been wanting to address this for a while, so thank you. I have some questions/suggestions. How should translation fit into this? Error messages are sometimes written to have dynamic values contained in them, such as I lean towards a system where the text of the error message is defined entirely on the frontend, with the error object containing parameters with which to construct a message. It makes sense for the backend to supply an error message for debugging purposes, but that field should indicate that it's not meant to be used in UI. I'd also like form validation errors to have a standard schema, so that the frontend can display validation errors in the appropriate place in the UI. Since we seem to be going towards having an array of error objects, we could attach a {
"errors": [{
"error_type": "INPUT_INVALID_URL",
"level": "error",
"debug_message": "Invalid url value for custom_url",
"field_name": "custom_url",
"message_params": {
"input": "https//notvalid"
}
}]
}
|
Dynamic error messages should be supported on the frontend with the translation package: https://github.com/apache-superset/superset-ui/tree/master/packages/superset-ui-translation#api My vision is to have a default renderer that simply renders the message passed from the backend, something we can guarantee exists every time. That's why i'd prefer not to label it as |
I think that vision makes sense. The additional definition on the type contract of I wonder if there is a more descriptive name out there than |
Yeah, if you have a better name than On the note of splitting extra out into other objects, my goal was to allow |
I've updated the SIP summary to include feedback from the thread and will be kicking off a vote now |
This has been approved/voted. Hooray! Closing :) |
[SIP-40] Proposal for Custom Error Messages
Motivation
The current user experience for error cases in Superset does not provide actionable feedback to users. Error messages often are displayed straight from the backend and are fairly inscrutable. Additionally, there’s no way to customize or add other functionality to these messages on a deployment by deployment basis. A key part of the user experience is providing friendly, actionable messaging when something goes wrong.
Proposed Change
We propose a new, unified pattern for error handling in API endpoints across all of Superset. This will consist of the following work:
SupersetAlert
component for handling all error messages. This component will import a renderer file that defaults to some generic error customization messages (ex. Adding Request Access links).New or Changed Public Interfaces
New dependencies
N/A
Migration Plan and Compatibility
No migrations should be necessary, but the new API may not be backwards compatible. Any changes to the current API will be notated in UPDATING.md and should take place prior to v1.0.0.
Rejected Alternatives
Server side rendering of errors was rejected as we’re trying to remove the existing templates and move all rendering to the client side
cc: @kristw @rusackas @nytai @graceguo-supercat @ktmud
The text was updated successfully, but these errors were encountered: