@bragduck/cli 2.9.2 → 2.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3424,18 +3424,36 @@ var JiraService = class {
3424
3424
  const maxResults = 100;
3425
3425
  while (true) {
3426
3426
  const endpoint = `/rest/api/2/search?jql=${encodeURIComponent(jql)}&startAt=${startAt}&maxResults=${maxResults}&fields=${fields.join(",")}`;
3427
- const response = await this.request(endpoint);
3428
- allIssues.push(...response.issues);
3429
- logger.debug(
3430
- `Fetched ${response.issues.length} issues (total: ${allIssues.length} of ${response.total})${startAt + maxResults < response.total ? ", fetching next page..." : ""}`
3431
- );
3432
- if (startAt + maxResults >= response.total) {
3433
- break;
3434
- }
3435
- if (options.limit && allIssues.length >= options.limit) {
3436
- return allIssues.slice(0, options.limit).map((issue) => this.transformIssueToCommit(issue));
3427
+ try {
3428
+ const response = await this.request(endpoint);
3429
+ allIssues.push(...response.issues);
3430
+ logger.debug(
3431
+ `Fetched ${response.issues.length} issues (total: ${allIssues.length} of ${response.total})${startAt + maxResults < response.total ? ", fetching next page..." : ""}`
3432
+ );
3433
+ if (startAt + maxResults >= response.total) {
3434
+ break;
3435
+ }
3436
+ if (options.limit && allIssues.length >= options.limit) {
3437
+ return allIssues.slice(0, options.limit).map((issue) => this.transformIssueToCommit(issue));
3438
+ }
3439
+ startAt += maxResults;
3440
+ } catch (error) {
3441
+ if (error instanceof JiraError && error.message.includes("no longer available")) {
3442
+ logger.warning(`Skipping unavailable Jira resource: ${error.message}`);
3443
+ if (allIssues.length > 0) {
3444
+ logger.info(
3445
+ `Returning ${allIssues.length} available issues (some resources were unavailable)`
3446
+ );
3447
+ break;
3448
+ }
3449
+ if (startAt === 0) {
3450
+ throw error;
3451
+ }
3452
+ startAt += maxResults;
3453
+ continue;
3454
+ }
3455
+ throw error;
3437
3456
  }
3438
- startAt += maxResults;
3439
3457
  }
3440
3458
  return allIssues.map((issue) => this.transformIssueToCommit(issue));
3441
3459
  }