From: Wouter Admiraal Date: Tue, 6 Apr 2021 09:51:05 +0000 (+0200) Subject: SONAR-13123 Handle WS errors when searching for issues X-Git-Tag: 8.9.0.43852~135 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b11bba243d603a4cc786a0187b0ed9b97e59f67d;p=sonarqube.git SONAR-13123 Handle WS errors when searching for issues --- diff --git a/server/sonar-web/src/main/js/api/issues.ts b/server/sonar-web/src/main/js/api/issues.ts index 357457a0ae4..3f5f88f3948 100644 --- a/server/sonar-web/src/main/js/api/issues.ts +++ b/server/sonar-web/src/main/js/api/issues.ts @@ -44,7 +44,7 @@ type FacetName = | 'types'; export function searchIssues(query: RequestData): Promise { - return getJSON('/api/issues/search', query); + return getJSON('/api/issues/search', query).catch(throwGlobalError); } export function getFacets( diff --git a/server/sonar-web/src/main/js/apps/issues/components/AppContainer.tsx b/server/sonar-web/src/main/js/apps/issues/components/AppContainer.tsx index b0c1f2b266c..2c22170bd48 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/AppContainer.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/AppContainer.tsx @@ -20,11 +20,11 @@ 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 };