diff --git a/superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.tsx b/superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.tsx
index 5798f3b41..9a131f1e2 100644
--- a/superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.tsx
+++ b/superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.tsx
@@ -41,7 +41,7 @@ function DatabaseErrorMessage({
const isVisualization = ['dashboard', 'explore'].includes(source);
- const body = (
+ const body = extra && (
<>
{t('This may be triggered by:')}
@@ -75,13 +75,16 @@ function DatabaseErrorMessage({
>
);
- const copyText = `${message}
+ const copyText =
+ extra && extra.issue_codes
+ ? `${message}
${t('This may be triggered by:')}
-${extra.issue_codes.map(issueCode => issueCode.message).join('\n')}`;
+${extra.issue_codes.map(issueCode => issueCode.message).join('\n')}`
+ : message;
return (
FlaskResponse:
message=utils.error_msg_from_exception(ex),
error_type=SupersetErrorType.GENERIC_BACKEND_ERROR,
level=ErrorLevel.ERROR,
- extra={},
),
],
status=ex.code or 500,
@@ -449,7 +448,6 @@ def show_unexpected_exception(ex: Exception) -> FlaskResponse:
message=utils.error_msg_from_exception(ex),
error_type=SupersetErrorType.GENERIC_BACKEND_ERROR,
level=ErrorLevel.ERROR,
- extra={},
),
],
)
diff --git a/tests/integration_tests/databases/commands_tests.py b/tests/integration_tests/databases/commands_tests.py
index 0fe6d6bc8..7d762b10f 100644
--- a/tests/integration_tests/databases/commands_tests.py
+++ b/tests/integration_tests/databases/commands_tests.py
@@ -587,7 +587,7 @@ class TestTestConnectionDatabaseCommand(SupersetTestCase):
connection exc is raised"""
database = get_example_database()
mock_get_sqla_engine.side_effect = SupersetSecurityException(
- SupersetError(error_type=500, message="test", level="info", extra={})
+ SupersetError(error_type=500, message="test", level="info")
)
db_uri = database.sqlalchemy_uri_decrypted
json_payload = {"sqlalchemy_uri": db_uri}