From c8a8d297507f6e5b5a3b5e276b94acdd797b08fb Mon Sep 17 00:00:00 2001 From: David Pepper <36296660+david-pepper@users.noreply.github.com> Date: Thu, 4 Jul 2024 13:27:03 +0100 Subject: [PATCH] remove unnecessary console.logs of errors --- .../src/salesforceHttp.ts | 14 +++----------- .../zuora-salesforce-link-remover/src/secrets.ts | 1 - .../src/updateZuoraBillingAccount.ts | 4 +--- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/handlers/zuora-salesforce-link-remover/src/salesforceHttp.ts b/handlers/zuora-salesforce-link-remover/src/salesforceHttp.ts index 2b3308b93b..0a401f6667 100644 --- a/handlers/zuora-salesforce-link-remover/src/salesforceHttp.ts +++ b/handlers/zuora-salesforce-link-remover/src/salesforceHttp.ts @@ -18,7 +18,6 @@ export async function doSfAuth( if (!response.ok) { const errorText = await response.text(); const errorMessage = `Error response from Salesforce: ${errorText}`; - console.error(errorMessage); throw new Error(errorMessage); } @@ -30,16 +29,13 @@ export async function doSfAuth( SalesforceAuthResponseSchema.safeParse(sfAuthResponse); if (!parseResponse.success) { - const parseError = `Error parsing response from Salesforce: ${JSON.stringify(parseResponse.error.format())}`; - console.error(parseError); - throw new Error(parseError); + throw new Error(`Error parsing response from Salesforce: ${JSON.stringify(parseResponse.error.format())}`); } return parseResponse.data; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); const errorText = `Error authenticating with Salesforce: ${errorMessage}`; - console.error(errorText); throw new Error(errorText); } } @@ -105,9 +101,7 @@ export async function executeSalesforceQuery( SalesforceQueryResponseSchema.safeParse(sfQueryResponse); if (!parseResponse.success) { - const parseError = `Error parsing response from Salesforce: ${JSON.stringify(parseResponse.error.format())}`; - console.error(parseError); - throw new Error(parseError); + throw new Error(`Error parsing response from Salesforce: ${JSON.stringify(parseResponse.error.format())}`); } return parseResponse.data; @@ -191,9 +185,7 @@ export async function doCompositeCallout( SalesforceUpdateResponseArraySchema.safeParse(sfUpdateResponse); if (!parseResponse.success) { - const parseError = `Error parsing response from Salesforce: ${JSON.stringify(parseResponse.error.format())}`; - console.error(parseError); - throw new Error(parseError); + throw new Error(`Error parsing response from Salesforce: ${JSON.stringify(parseResponse.error.format())}`); } return parseResponse.data; diff --git a/handlers/zuora-salesforce-link-remover/src/secrets.ts b/handlers/zuora-salesforce-link-remover/src/secrets.ts index ee0523f99a..2740834583 100644 --- a/handlers/zuora-salesforce-link-remover/src/secrets.ts +++ b/handlers/zuora-salesforce-link-remover/src/secrets.ts @@ -55,7 +55,6 @@ export async function getSecretValue(secretName: string): Promise { } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); const errorText = `error getting secret: ${errorMessage}`; - console.error(errorText); throw new Error(errorText); } } diff --git a/handlers/zuora-salesforce-link-remover/src/updateZuoraBillingAccount.ts b/handlers/zuora-salesforce-link-remover/src/updateZuoraBillingAccount.ts index bb9970a0fd..ff3fa4301a 100644 --- a/handlers/zuora-salesforce-link-remover/src/updateZuoraBillingAccount.ts +++ b/handlers/zuora-salesforce-link-remover/src/updateZuoraBillingAccount.ts @@ -7,9 +7,7 @@ export const handler: Handler = async (event: Event) => { const parseResponse = EventSchema.safeParse(event); if (!parseResponse.success) { - const parseError = `Error parsing billing account id from input: ${JSON.stringify(parseResponse.error.format())}`; - console.error(parseError); - throw new Error(parseError); + throw new Error(`Error parsing billing account id from input: ${JSON.stringify(parseResponse.error.format())}`); } const zuoraBillingAccountId = parseResponse.data.Zuora__External_Id__c;