From ebf9624d647ac88de5e2553de2eb3c804568317c Mon Sep 17 00:00:00 2001 From: Dilip Kola Date: Tue, 3 Sep 2024 11:39:55 +0530 Subject: [PATCH] fix: error messages in gaec --- src/cdk/v2/destinations/webhook_v2/utils.js | 2 +- .../google_adwords_enhanced_conversions/networkHandler.js | 4 +--- .../dataDelivery/business.ts | 6 +++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/cdk/v2/destinations/webhook_v2/utils.js b/src/cdk/v2/destinations/webhook_v2/utils.js index bf0f2179f1..8e04b59ec0 100644 --- a/src/cdk/v2/destinations/webhook_v2/utils.js +++ b/src/cdk/v2/destinations/webhook_v2/utils.js @@ -52,7 +52,7 @@ const excludeMappedFields = (payload, mapping) => { // Traverse to the parent of the key to be removed keys.slice(0, -1).forEach((key) => { - if (current && current[key]) { + if (current?.[key]) { current = current[key]; } else { current = null; diff --git a/src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js b/src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js index d91c79e186..a2795a1671 100644 --- a/src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js +++ b/src/v0/destinations/google_adwords_enhanced_conversions/networkHandler.js @@ -127,9 +127,7 @@ const responseHandler = (responseParams) => { // Ref - https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto if (partialFailureError && partialFailureError.code !== 0) { throw new NetworkError( - `[Google Adwords Enhanced Conversions]:: partialFailureError - ${JSON.stringify( - partialFailureError, - )}`, + JSON.stringify(partialFailureError), 400, { [tags.TAG_NAMES.ERROR_TYPE]: getDynamicErrorType(400), diff --git a/test/integrations/destinations/google_adwords_enhanced_conversions/dataDelivery/business.ts b/test/integrations/destinations/google_adwords_enhanced_conversions/dataDelivery/business.ts index a5bbaa05c5..d318066e7d 100644 --- a/test/integrations/destinations/google_adwords_enhanced_conversions/dataDelivery/business.ts +++ b/test/integrations/destinations/google_adwords_enhanced_conversions/dataDelivery/business.ts @@ -176,7 +176,7 @@ export const testScenariosForV0API = [ 'Conversion already has enhancements with the same Order ID and conversion action. Make sure your data is correctly configured and try again., at conversion_adjustments[0]', }, message: - '[Google Adwords Enhanced Conversions]:: partialFailureError - {"code":3,"message":"Conversion already has enhancements with the same Order ID and conversion action. Make sure your data is correctly configured and try again., at conversion_adjustments[0]","details":[{"@type":"type.googleapis.com/google.ads.googleads.v15.errors.GoogleAdsFailure","errors":[{"errorCode":{"conversionAdjustmentUploadError":"CONVERSION_ALREADY_ENHANCED"},"message":"Conversion already has enhancements with the same Order ID and conversion action. Make sure your data is correctly configured and try again.","location":{"fieldPathElements":[{"fieldName":"conversion_adjustments","index":0}]}}]}]}', + '{"code":3,"message":"Conversion already has enhancements with the same Order ID and conversion action. Make sure your data is correctly configured and try again., at conversion_adjustments[0]","details":[{"@type":"type.googleapis.com/google.ads.googleads.v15.errors.GoogleAdsFailure","errors":[{"errorCode":{"conversionAdjustmentUploadError":"CONVERSION_ALREADY_ENHANCED"},"message":"Conversion already has enhancements with the same Order ID and conversion action. Make sure your data is correctly configured and try again.","location":{"fieldPathElements":[{"fieldName":"conversion_adjustments","index":0}]}}]}]}', statTags: expectedStatTags, status: 400, }, @@ -262,11 +262,11 @@ export const testScenariosForV1API: ProxyV1TestData[] = [ body: { output: { message: - '[Google Adwords Enhanced Conversions]:: partialFailureError - {"code":3,"message":"Conversion already has enhancements with the same Order ID and conversion action. Make sure your data is correctly configured and try again., at conversion_adjustments[0]","details":[{"@type":"type.googleapis.com/google.ads.googleads.v15.errors.GoogleAdsFailure","errors":[{"errorCode":{"conversionAdjustmentUploadError":"CONVERSION_ALREADY_ENHANCED"},"message":"Conversion already has enhancements with the same Order ID and conversion action. Make sure your data is correctly configured and try again.","location":{"fieldPathElements":[{"fieldName":"conversion_adjustments","index":0}]}}]}]}', + '{"code":3,"message":"Conversion already has enhancements with the same Order ID and conversion action. Make sure your data is correctly configured and try again., at conversion_adjustments[0]","details":[{"@type":"type.googleapis.com/google.ads.googleads.v15.errors.GoogleAdsFailure","errors":[{"errorCode":{"conversionAdjustmentUploadError":"CONVERSION_ALREADY_ENHANCED"},"message":"Conversion already has enhancements with the same Order ID and conversion action. Make sure your data is correctly configured and try again.","location":{"fieldPathElements":[{"fieldName":"conversion_adjustments","index":0}]}}]}]}', response: [ { error: - '[Google Adwords Enhanced Conversions]:: partialFailureError - {"code":3,"message":"Conversion already has enhancements with the same Order ID and conversion action. Make sure your data is correctly configured and try again., at conversion_adjustments[0]","details":[{"@type":"type.googleapis.com/google.ads.googleads.v15.errors.GoogleAdsFailure","errors":[{"errorCode":{"conversionAdjustmentUploadError":"CONVERSION_ALREADY_ENHANCED"},"message":"Conversion already has enhancements with the same Order ID and conversion action. Make sure your data is correctly configured and try again.","location":{"fieldPathElements":[{"fieldName":"conversion_adjustments","index":0}]}}]}]}', + '{"code":3,"message":"Conversion already has enhancements with the same Order ID and conversion action. Make sure your data is correctly configured and try again., at conversion_adjustments[0]","details":[{"@type":"type.googleapis.com/google.ads.googleads.v15.errors.GoogleAdsFailure","errors":[{"errorCode":{"conversionAdjustmentUploadError":"CONVERSION_ALREADY_ENHANCED"},"message":"Conversion already has enhancements with the same Order ID and conversion action. Make sure your data is correctly configured and try again.","location":{"fieldPathElements":[{"fieldName":"conversion_adjustments","index":0}]}}]}]}', metadata: generateMetadata(1), statusCode: 400, },