Skip to content

Commit

Permalink
this is annoying...
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-corbalt committed Mar 7, 2024
1 parent 84c098b commit 462b041
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 55 deletions.
52 changes: 16 additions & 36 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 2 additions & 19 deletions src/libs/jira-lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export class Jira {
let total = 0;

do {
try {
//try {
const response = await this.axiosInstance.post('/rest/api/2/search', {
jql: fullQuery,
startAt: startAt,
Expand All @@ -157,25 +157,8 @@ export class Jira {
total = results.total;
//} catch (error) {
//throw new Error(`Error getting Security Hub issues from Jira: ${error}`);
// throw new Error(`Error getting Security Hub issues from Jira: ${error instanceof AggregateError ? error.message : error}`);
//throw new Error(`Error getting Security Hub issues from Jira: ${error instanceof AggregateError ? error.message : error}`);
//}
} catch (error: unknown) {
if (error instanceof AggregateError) {
// Log each error in the AggregateError
error.errors.forEach((err, index) => {
console.error(`Error ${index + 1}:`, err);
});
// Optionally, you can throw a new error with combined messages or handle it differently
const combinedMessage = error.errors.map((err, index) => `Error ${index + 1}: ${err.message || err}`).join('\n');
throw new Error(`Error getting Security Hub issues from Jira: ${combinedMessage}`);
} else if (error instanceof Error) {
// Handle regular Error objects
throw new Error(`Error getting Security Hub issues from Jira: ${error.message}`);
} else {
// Handle cases where the caught value is not an Error object
throw new Error(`An unexpected error occurred: ${String(error)}`);
}
}
} while (totalIssuesReceived < total);

return allIssues;
Expand Down

0 comments on commit 462b041

Please sign in to comment.