From 382274933828025454912318854649753c40cedc Mon Sep 17 00:00:00 2001 From: Andrew Cremins Date: Thu, 7 Mar 2024 13:17:22 -0800 Subject: [PATCH] ... again.......... --- dist/index.js | 15 ++++----------- src/libs/jira-lib.ts | 19 +++++-------------- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/dist/index.js b/dist/index.js index 6040a6b..b606cb9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -82167,20 +82167,13 @@ class Jira { } catch (error) { if (error instanceof axios_1.AxiosError) { - console.log("We have an AxiosError"); - } - console.log(error.constructor.name); - let errMsg = error.errors ? error.errors.map((err) => err.toString()).join(', ') : error.toString(); - console.error(errMsg); - if (error instanceof AggregateError) { - console.error("we got an aggregate error"); - const errors = error.errors; - for (const error of errors) { - console.log(error.message); + if (error.cause instanceof AggregateError) { + let errMsg = error.cause.errors ? error.cause.errors.map((err) => err.toString()).join(', ') : error.toString(); + console.error(errMsg); } } else { - throw new Error(`Error getting Security Hub issues from Jira test: ${error} test`); + throw new Error(`Error getting Security Hub issues from Jira: ${error}`); } } } while (totalIssuesReceived < total); diff --git a/src/libs/jira-lib.ts b/src/libs/jira-lib.ts index a1906fb..40ac2f1 100644 --- a/src/libs/jira-lib.ts +++ b/src/libs/jira-lib.ts @@ -155,24 +155,15 @@ export class Jira { totalIssuesReceived += results.issues.length; startAt = totalIssuesReceived; total = results.total; - } catch (error: any) { + } catch (error: unknown) { if (error instanceof AxiosError) { - console.log("We have an AxiosError") - } - console.log(error.constructor.name); - let errMsg = error.errors ? error.errors.map((err: any) => err.toString()).join(', ') : error.toString(); - console.error(errMsg); - if (error instanceof AggregateError) { - console.error("we got an aggregate error"); - - const errors = error.errors; - - for (const error of errors) { - console.log(error.message); + if (error.cause instanceof AggregateError) { + let errMsg = error.cause.errors ? error.cause.errors.map((err: any) => err.toString()).join(', ') : error.toString(); + console.error(errMsg); } } else { - throw new Error(`Error getting Security Hub issues from Jira test: ${error} test`); + throw new Error(`Error getting Security Hub issues from Jira: ${error}`); } } } while (totalIssuesReceived < total);