]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-13123 Handle WS errors when searching for issues
authorWouter Admiraal <wouter.admiraal@sonarsource.com>
Tue, 6 Apr 2021 09:51:05 +0000 (11:51 +0200)
committersonartech <sonartech@sonarsource.com>
Fri, 9 Apr 2021 20:03:53 +0000 (20:03 +0000)
server/sonar-web/src/main/js/api/issues.ts
server/sonar-web/src/main/js/apps/issues/components/AppContainer.tsx

index 357457a0ae479d427c4b40eb14dec55d5d2ec5aa..3f5f88f394808704fa00a254772239a40156de62 100644 (file)
@@ -44,7 +44,7 @@ type FacetName =
   | 'types';
 
 export function searchIssues(query: RequestData): Promise<RawIssuesResponse> {
-  return getJSON('/api/issues/search', query);
+  return getJSON('/api/issues/search', query).catch(throwGlobalError);
 }
 
 export function getFacets(
index b0c1f2b266c954e68f34853eea8ce1faf95af13e..2c22170bd485ed5f8c0881003b9dffe6bd9dcc2b 100644 (file)
 import { connect } from 'react-redux';
 import { lazyLoadComponent } from 'sonar-ui-common/components/lazyLoadComponent';
 import { searchIssues } from '../../../api/issues';
-import throwGlobalError from '../../../app/utils/throwGlobalError';
 import { withRouter } from '../../../components/hoc/withRouter';
 import { parseIssueFromResponse } from '../../../helpers/issues';
 import { fetchBranchStatus } from '../../../store/rootActions';
 import { getCurrentUser, Store } from '../../../store/rootReducer';
+import { FetchIssuesPromise } from '../../../types/issues';
 
 const IssuesAppContainer = lazyLoadComponent(() => import('./App'), 'IssuesAppContainer');
 
@@ -38,14 +38,12 @@ const fetchIssues = (query: T.RawQuery) => {
     ...query,
     additionalFields: '_all',
     timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone
-  })
-    .then(response => {
-      const parsedIssues = response.issues.map(issue =>
-        parseIssueFromResponse(issue, response.components, response.users, response.rules)
-      );
-      return { ...response, issues: parsedIssues };
-    })
-    .catch(throwGlobalError);
+  }).then(response => {
+    const parsedIssues = response.issues.map(issue =>
+      parseIssueFromResponse(issue, response.components, response.users, response.rules)
+    );
+    return { ...response, issues: parsedIssues } as FetchIssuesPromise;
+  });
 };
 
 const mapDispatchToProps = { fetchBranchStatus };