improvements in hubspotConnector and in the Keystone library
This commit is contained in:
1 parent
5a2022fd9e
commit
751a60a301
3 files changed
+52
-56
No files matched your search
@@ -1,5 +1,4 @@
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
require('dotenv').config({ path: path.resolve(__dirname, '../.env') });
|
||||
|
||||
@@ -24,7 +23,7 @@ async function getLeads(lastRunDate, currentDate, unsent, test) {
|
||||
const result = await response.json();
|
||||
|
||||
if (!response.ok || !Array.isArray(result?.data)) {
|
||||
console.log('API response empty or invalid: ', result);
|
||||
console.log('API response empty or invalid: ', result.message || response.statusText);
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -41,8 +40,8 @@ async function getLeads(lastRunDate, currentDate, unsent, test) {
|
||||
return result.data;
|
||||
}
|
||||
catch (error) {
|
||||
console.error("Error fetching the data: ", JSON.stringify(error.response?.data, null, 2) || error.message);
|
||||
return [];
|
||||
console.error("Error fetching the data: ", error.message);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user