diff --git a/src/helpers/api.helper.ts b/src/helpers/api.helper.ts index b2f59ef..af01dad 100644 --- a/src/helpers/api.helper.ts +++ b/src/helpers/api.helper.ts @@ -42,7 +42,7 @@ export class ApiHelper { return response; } catch (error: any) { this.logger.logError("Error in ApiHelper->get"); - throw error; + throw new Error(`Error in get request ${error.message}`); } } } diff --git a/src/helpers/apiClient.ts b/src/helpers/apiClient.ts index 25af8a5..40eb33d 100644 --- a/src/helpers/apiClient.ts +++ b/src/helpers/apiClient.ts @@ -32,8 +32,9 @@ export class ApiClient { return config as InternalAxiosRequestConfig; }, (error) => { - this.errorHandler.handleError(error); - return Promise.reject(error); + const errorObj = new Error(`Error in interceptors request: ${error.message}`); + this.errorHandler.handleError(errorObj); + return Promise.reject(errorObj); }, ); @@ -43,8 +44,9 @@ export class ApiClient { return response; }, (error) => { - this.errorHandler.handleError(error); - return Promise.reject(error); + const errorObj = new Error(`Error in interceptors response: ${error.message}`); + this.errorHandler.handleError(errorObj); + return Promise.reject(errorObj); }, ); } @@ -62,10 +64,11 @@ export class ApiClient { span.end(new Date()); return response.data; } catch (error: any) { + const errorObj = new Error(`Error in get request: ${error.message}`); span.setStatus(error.code); span.end(new Date()); - Sentry.captureException(error); - throw error; + Sentry.captureException(errorObj); + throw errorObj; } }, ); @@ -84,10 +87,11 @@ export class ApiClient { span.end(new Date()); return response.data; } catch (error: any) { + const errorObj = new Error(`Error in post request: ${error.message}`); span.setStatus(error.code); span.end(new Date()); - Sentry.captureException(error); - throw error; + Sentry.captureException(errorObj); + throw errorObj; } }, ); diff --git a/src/helpers/command.helper.ts b/src/helpers/command.helper.ts index 5775745..7530b91 100644 --- a/src/helpers/command.helper.ts +++ b/src/helpers/command.helper.ts @@ -36,14 +36,14 @@ export class Command { if (accessToken) { this.logger.logMessageByStatus( MessageStatus.INFO, - `${Messages.CMD_EXEC_WITH_ACCESS_TOKEN}: "${command} "`, + `${Messages.CMD_EXEC_WITH_ACCESS_TOKEN}`, ); command = `${command} ${globalFlags[0].flag} ${accessToken}`; } } else { this.logger.logMessageByStatus( MessageStatus.INFO, - `${Messages.CMD_EXEC_WITHOUT_ACCESS_TOKEN}: "${command}"`, + `${Messages.CMD_EXEC_WITHOUT_ACCESS_TOKEN}"`, ); } diff --git a/src/helpers/errorHandler.ts b/src/helpers/errorHandler.ts index f7c7dde..3bcf90b 100644 --- a/src/helpers/errorHandler.ts +++ b/src/helpers/errorHandler.ts @@ -14,7 +14,7 @@ export class ErrorHandler { this.logError(errorMessage, errorStack); this.showUserErrorMessage(customErrorMessage ?? errorMessage); - this.sentryHelper.captureException(new Error(`Error Found :`, error)); + this.sentryHelper.captureException(new Error(`Error Found :`, error.message)); } private extractErrorMessage(error: unknown): string { diff --git a/src/services/scan.service.ts b/src/services/scan.service.ts index 6743544..995e79f 100644 --- a/src/services/scan.service.ts +++ b/src/services/scan.service.ts @@ -164,7 +164,7 @@ export class ScanService { case "-j": if (selectedFlags.report) { cmdParams.push(selectedFlags.report); - Logger.logMessageByStatus(MessageStatus.INFO, `Report added: ${selectedFlags.report}`); + Logger.logMessageByStatus(MessageStatus.INFO, `Report added`); } break;