chore: Added logging of what data was received, whether it passed validation or not
This commit is contained in:
parent
f6b21ed84d
commit
1a63649bef
2 changed files with 6 additions and 0 deletions
4
main.js
4
main.js
|
@ -38,6 +38,8 @@ async function main() {
|
|||
const results = await srv.parseCurrencies();
|
||||
|
||||
if (Array.isArray(results) && results.length > 0) {
|
||||
console.log(`Data received from ${srv.name || 'unknown service'}:`, results.length, 'items');
|
||||
|
||||
for (const result of results) {
|
||||
try {
|
||||
const currency = await validateCurrency(result);
|
||||
|
@ -51,7 +53,9 @@ async function main() {
|
|||
currency.date,
|
||||
]
|
||||
);
|
||||
console.log(`Inserted data for ${currency.from_currency} -> ${currency.conv_currency}, Rate: ${currency.rate}`);
|
||||
} catch (validationError) {
|
||||
console.error('Validation failed for data:', result);
|
||||
console.error(validationError);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ module.exports = {
|
|||
const truncatedPriceStr = truncate_number(data.price, 3);
|
||||
const rate = parseFloat(truncatedPriceStr);
|
||||
|
||||
console.log(`Data fetched from CoinMarketCap: ${fromCurrency} -> ${convCurrency}, Rate: ${rate}`);
|
||||
|
||||
return {
|
||||
from_currency: fromCurrency,
|
||||
conv_currency: convCurrency,
|
||||
|
|
Loading…
Add table
Reference in a new issue