etr2460 commented on a change in pull request #10274:
URL:
https://github.com/apache/incubator-superset/pull/10274#discussion_r454446847
##########
File path: superset/errors.py
##########
@@ -46,6 +47,23 @@ class SupersetErrorType(str, Enum):
DATASOURCE_SECURITY_ACCESS_ERROR = "DATASOURCE_SECURITY_ACCESS_ERROR"
MISSING_OWNERSHIP_ERROR = "MISSING_OWNERSHIP_ERROR"
+ # Other errors
+ BACKEND_TIMEOUT_ERROR = "BACKEND_TIMEOUT_ERROR"
+
+
+ERROR_TYPES_TO_ERROR_CODES_MAPPING = {
+ SupersetErrorType.BACKEND_TIMEOUT_ERROR: [
+ {
+ "code": 1000,
+ "message": _("Error 1000 - The datasource is too large to query."),
+ },
+ {
+ "code": 1001,
+ "message": _("Error 1001 - The database is under an unusual
load."),
+ },
+ ]
+}
Review comment:
Do you not find it a bit inconsistent that the same object is used both
for the error code and for possible causes? These seem like they should be
different things, just as a symptom (a bad cough) is different from a root
cause (like the flu or allergies). We want the docs to provide remedies for the
flu or allergies, and not simply prescribe cough drops.
My struggle is how to manage this mapping in the cleanest possible way. To
me it seems like error_type and error_codes need to be seperate objects, each
with different limitations (every error only has 1 error type, while it could
have multiple error codes since they represent potential root causes).
Perhaps this is a naming issue. If these were named error_causes, and we
displayed `Cause 1000` and `Cause 1001` within the box, would this be clearer?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]