Skip to content

Commit

Permalink
This is getting silly
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-corbalt committed Mar 7, 2024
1 parent 45c1710 commit 84c098b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
23 changes: 21 additions & 2 deletions dist/index.js

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

21 changes: 19 additions & 2 deletions src/libs/jira-lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,27 @@ export class Jira {
totalIssuesReceived += results.issues.length;
startAt = totalIssuesReceived;
total = results.total;
} catch (error) {
//} 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 84c098b

Please sign in to comment.