From 6e6aa2f0d5e4cba836259b28075d4fffb59f53e9 Mon Sep 17 00:00:00 2001 From: Wisley Alves Date: Fri, 4 Oct 2024 12:38:25 -0300 Subject: [PATCH] fix(import-products): add debug --- functions/lib/integration/import-product.js | 6 ++++++ functions/lib/integration/parsers/product-to-ecomplus.js | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/functions/lib/integration/import-product.js b/functions/lib/integration/import-product.js index a8f595f..9636624 100644 --- a/functions/lib/integration/import-product.js +++ b/functions/lib/integration/import-product.js @@ -265,6 +265,12 @@ module.exports = async ({ appSdk, storeId, auth }, _blingStore, blingDeposit, qu const { product, variationId } = payload const isStockOnly = Boolean(product && !(appData.update_product || appData.update_product_auto)) return createUpdateProduct({ appSdk, storeId, auth }, appData, sku, product, variationId, blingDeposit, blingProduct, isStockOnly) + .catch(err => { + if (err.response && err.response.data) { + logger.warn(`${err.response.data}`) + } + throw err + }) }) .catch(err => { if (err.message === 'Skip') { diff --git a/functions/lib/integration/parsers/product-to-ecomplus.js b/functions/lib/integration/parsers/product-to-ecomplus.js index 1ae2f6d..7b98430 100644 --- a/functions/lib/integration/parsers/product-to-ecomplus.js +++ b/functions/lib/integration/parsers/product-to-ecomplus.js @@ -1,6 +1,6 @@ const ecomUtils = require('@ecomplus/utils') const axios = require('axios') -const { logger } = require('../../../context') +// const { logger } = require('../../../context') const FormData = require('form-data') const removeAccents = str => str.replace(/áàãâÁÀÃÂ/g, 'a') @@ -315,7 +315,7 @@ module.exports = (blingProduct, variations, storeId, auth, isNew = true, appData variation.specifications = specifications variation.quantity = variacao.estoqueAtual || 0 - logger.warn(`BlingV: ${JSON.stringify(variacao)} v:${JSON.stringify(variation)}`) + // logger.warn(`BlingV: ${JSON.stringify(variacao)} v:${JSON.stringify(variation)}`) if (pictureId > 0) { variation.picture_id = pictureId