diff --git a/superset-frontend/src/SqlLab/components/ResultSet/ResultSet.test.tsx b/superset-frontend/src/SqlLab/components/ResultSet/ResultSet.test.tsx
index 31412afd22c42..0045e993eb82d 100644
--- a/superset-frontend/src/SqlLab/components/ResultSet/ResultSet.test.tsx
+++ b/superset-frontend/src/SqlLab/components/ResultSet/ResultSet.test.tsx
@@ -30,7 +30,6 @@ import fetchMock from 'fetch-mock';
import ResultSet from 'src/SqlLab/components/ResultSet';
import {
cachedQuery,
- failedQueryWithErrorMessage,
failedQueryWithErrors,
queries,
runningQuery,
@@ -41,6 +40,11 @@ import {
failedQueryWithFrontendTimeoutErrors,
} from 'src/SqlLab/fixtures';
+jest.mock(
+ 'src/components/ErrorMessage/ErrorMessageWithStackTrace',
+ () => () =>
Error
,
+);
+
const mockedProps = {
cache: true,
queryId: queries[0].id,
@@ -93,15 +97,6 @@ const cachedQueryState = {
},
},
};
-const failedQueryWithErrorMessageState = {
- ...initialState,
- sqlLab: {
- ...initialState.sqlLab,
- queries: {
- [failedQueryWithErrorMessage.id]: failedQueryWithErrorMessage,
- },
- },
-};
const failedQueryWithErrorsState = {
...initialState,
sqlLab: {
@@ -314,26 +309,17 @@ describe('ResultSet', () => {
expect(getByText('fetching')).toBeInTheDocument();
});
- test('should render a failed query with an error message', async () => {
- await waitFor(() => {
- setup(
- { ...mockedProps, queryId: failedQueryWithErrorMessage.id },
- mockStore(failedQueryWithErrorMessageState),
- );
- });
-
- expect(screen.getByText('Database error')).toBeInTheDocument();
- expect(screen.getByText('Something went wrong')).toBeInTheDocument();
- });
-
test('should render a failed query with an errors object', async () => {
+ const { errors } = failedQueryWithErrors;
+
await waitFor(() => {
setup(
{ ...mockedProps, queryId: failedQueryWithErrors.id },
mockStore(failedQueryWithErrorsState),
);
});
- expect(screen.getByText('Database error')).toBeInTheDocument();
+ const errorMessages = screen.getAllByTestId('error-message');
+ expect(errorMessages).toHaveLength(errors.length);
});
test('should render a timeout error with a retrial button', async () => {
diff --git a/superset-frontend/src/SqlLab/components/ResultSet/index.tsx b/superset-frontend/src/SqlLab/components/ResultSet/index.tsx
index f6d73a4072caa..db44fdda164ba 100644
--- a/superset-frontend/src/SqlLab/components/ResultSet/index.tsx
+++ b/superset-frontend/src/SqlLab/components/ResultSet/index.tsx
@@ -42,7 +42,6 @@ import {
css,
getNumberFormatter,
getExtensionsRegistry,
- ErrorLevel,
ErrorTypeEnum,
} from '@superset-ui/core';
import ErrorMessageWithStackTrace from 'src/components/ErrorMessage/ErrorMessageWithStackTrace';
@@ -559,16 +558,7 @@ const ResultSet = ({
}
if (query.state === QueryState.Failed) {
- const errors = [];
- if (query.errorMessage) {
- errors.push({
- error_type: ErrorTypeEnum.GENERIC_DB_ENGINE_ERROR,
- extra: {},
- level: 'error' as ErrorLevel,
- message: query.errorMessage,
- });
- }
- errors.push(...(query.extra?.errors || []), ...(query.errors || []));
+ const errors = [...(query.extra?.errors || []), ...(query.errors || [])];
return (
diff --git a/superset-frontend/src/SqlLab/fixtures.ts b/superset-frontend/src/SqlLab/fixtures.ts
index 5ee4461ff7eed..c974293d0e24d 100644
--- a/superset-frontend/src/SqlLab/fixtures.ts
+++ b/superset-frontend/src/SqlLab/fixtures.ts
@@ -532,6 +532,12 @@ export const failedQueryWithErrors = {
level: 'error',
extra: null,
},
+ {
+ message: 'Something else wrong',
+ error_type: 'TEST_ERROR',
+ level: 'error',
+ extra: null,
+ },
],
id: 'ryhMUZCGb',
progress: 0,