From b03f01e31127e3fcfb54c3a9836baaf6d900cd02 Mon Sep 17 00:00:00 2001 From: Joe Yeager Date: Tue, 14 Jan 2025 09:56:41 -0800 Subject: [PATCH] fix debug logging --- lib/errorHandlers/index.ts | 7 +++++-- lib/projects/upload.ts | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/errorHandlers/index.ts b/lib/errorHandlers/index.ts index 0a521d1c9..45f74b8e3 100644 --- a/lib/errorHandlers/index.ts +++ b/lib/errorHandlers/index.ts @@ -6,6 +6,7 @@ import { import { shouldSuppressError } from './suppressError'; import { i18n } from '../lang'; import util from 'util'; +import { isAxiosError } from 'axios'; const i18nKey = 'lib.errorHandlers.index'; @@ -50,10 +51,12 @@ export function debugError(error: unknown, context?: ApiErrorContext): void { logger.debug(i18n(`${i18nKey}.errorOccurred`, { error: String(error) })); } - if (error instanceof Error) { + if (error instanceof Error && error.cause) { logger.debug( i18n(`${i18nKey}.errorCause`, { - cause: util.inspect(error.cause, false, null, true), + cause: isAxiosError(error.cause) + ? `${error.cause}` + : util.inspect(error.cause, false, null, true), }) ); } diff --git a/lib/projects/upload.ts b/lib/projects/upload.ts index d5f5a42d0..ab0003064 100644 --- a/lib/projects/upload.ts +++ b/lib/projects/upload.ts @@ -160,7 +160,6 @@ export async function handleProjectUpload( ); if (error) { - console.log(error); uploadResult = { uploadError: error }; } else if (callbackFunc) { uploadResult = await callbackFunc(