Skip to content

Commit

Permalink
remove unnecessary console.logs of errors
Browse files Browse the repository at this point in the history
  • Loading branch information
david-pepper committed Jul 4, 2024
1 parent 379efb6 commit c8a8d29
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
14 changes: 3 additions & 11 deletions handlers/zuora-salesforce-link-remover/src/salesforceHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
}
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion handlers/zuora-salesforce-link-remover/src/secrets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export async function getSecretValue<T>(secretName: string): Promise<T> {
} catch (error) {
const errorMessage = error instanceof Error ? error.message : String(error);
const errorText = `error getting secret: ${errorMessage}`;
console.error(errorText);
throw new Error(errorText);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c8a8d29

Please sign in to comment.