Skip to content

Commit bb4f522

Browse files
Adds short-term fix to allow Jira issues to appear when some orgs fail
1 parent 320034f commit bb4f522

File tree

1 file changed

+16
-9
lines changed
  • src/plus/integrations/providers

1 file changed

+16
-9
lines changed

src/plus/integrations/providers/jira.ts

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { IssueIntegrationId } from '../../../constants.integrations';
44
import type { Account } from '../../../git/models/author';
55
import type { IssueOrPullRequest, SearchedIssue } from '../../../git/models/issue';
66
import { filterMap, flatten } from '../../../system/iterable';
7+
import { Logger } from '../../../system/logger';
78
import type { IntegrationAuthenticationProviderDescriptor } from '../authentication/integrationAuthentication';
89
import type { ResourceDescriptor } from '../integration';
910
import { IssueIntegration } from '../integration';
@@ -232,15 +233,21 @@ export class JiraIntegration extends IssueIntegration<IssueIntegrationId.Jira> {
232233

233234
const results: SearchedIssue[] = [];
234235
for (const resource of myResources) {
235-
const userLogin = (await this.getProviderAccountForResource(session, resource))?.username;
236-
const resourceIssues = await api.getIssuesForResourceForCurrentUser(this.id, resource.id, {
237-
accessToken: session.accessToken,
238-
});
239-
const formattedIssues = resourceIssues
240-
?.map(issue => toSearchedIssue(issue, this, undefined, userLogin))
241-
.filter((result): result is SearchedIssue => result != null);
242-
if (formattedIssues != null) {
243-
results.push(...formattedIssues);
236+
try {
237+
const userLogin = (await this.getProviderAccountForResource(session, resource))?.username;
238+
const resourceIssues = await api.getIssuesForResourceForCurrentUser(this.id, resource.id, {
239+
accessToken: session.accessToken,
240+
});
241+
const formattedIssues = resourceIssues
242+
?.map(issue => toSearchedIssue(issue, this, undefined, userLogin))
243+
.filter((result): result is SearchedIssue => result != null);
244+
if (formattedIssues != null) {
245+
results.push(...formattedIssues);
246+
}
247+
} catch (ex) {
248+
// TODO: We need a better way to message the failure to the user here.
249+
// This is a stopgap to prevent one bag org from throwing and preventing any issues from being returned.
250+
Logger.error(ex, 'searchProviderMyIssues');
244251
}
245252
}
246253

0 commit comments

Comments
 (0)