Skip to content

Commit ad1ee1a

Browse files
committed
Temporary custom errors for testing
1 parent 6766f4e commit ad1ee1a

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

superset/custom_database_errors.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import re
1919
from typing import Any
2020

21+
from flask_babel import gettext as __
22+
2123
from superset.errors import SupersetErrorType
2224

2325
# CUSTOM_DATABASE_ERRORS: Configure custom error messages for database exceptions.
@@ -55,4 +57,27 @@
5557

5658
CUSTOM_DATABASE_ERRORS: dict[
5759
str, dict[re.Pattern[str], tuple[str, SupersetErrorType, dict[str, Any]]]
58-
] = {}
60+
] = {
61+
"examples": {
62+
re.compile("no such table: a"): (
63+
__("This is custom error message for a"),
64+
SupersetErrorType.GENERIC_DB_ENGINE_ERROR,
65+
{
66+
"custom_doc_links": [
67+
{
68+
"url": "https://example.com/docs/1",
69+
"label": "Custom documentation link",
70+
},
71+
],
72+
"show_issue_info": False,
73+
},
74+
),
75+
re.compile("no such table: b"): (
76+
__("This is custom error message for b"),
77+
SupersetErrorType.GENERIC_DB_ENGINE_ERROR,
78+
{
79+
"show_issue_info": True,
80+
},
81+
),
82+
}
83+
}

0 commit comments

Comments
 (0)