Description
[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:
- Unify the backend around a standard error payload for all API errors returned from Superset of the format:
{
errors: [
{
message: string,
error_type: Enum,
level: ‘info’ | ‘warning’ | ‘error’,
extra: Dict[string, Any],
}, ...
]
}
- Create an Enum on both the server and client side for uniquely identifying error types. The specific type of an error is included in the standard error payload (e.g. ACCESS_DENIED, DB_ENGINE_SYNTAX_ERROR, etc.)
- Refactor Superset’s frontend to go through a single
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). - Allow a Superset admin to specify an override renderer file that gets used instead of the default renderer. This override renderer is injected by leveraging the Registry class from @superset-ui/core to handle the custom renderers registration.
New or Changed Public Interfaces
- All APIs within Superset will return the above error payload on 4xx and 5xx status code responses.
- Client side options will be made public for injecting your own error rendering file
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
Metadata
Metadata
Assignees
Type
Projects
Status
Implemented / Done
Activity