debug: widen NADDOD error slice to 300 chars, add pre-insert logging
This commit is contained in:
parent
24481b09e6
commit
d9e5331161
@ -275,13 +275,15 @@ export async function scrapeNaddod(): Promise<void> {
|
||||
// Price observation
|
||||
if (price && price > 0) {
|
||||
const hash = contentHash({ price, part: partNumber });
|
||||
const sl: string = stock?.qty !== undefined && stock.qty > 0 ? "in_stock" :
|
||||
stock?.confidence === 1 ? "in_stock" : "on_request";
|
||||
console.log(` [DEBUG] upsertPrice: txId=${txId} price=${price} stockLevel=${sl} hash=${hash.slice(0,8)}`);
|
||||
const isNew = await upsertPriceObservation({
|
||||
transceiverId: txId,
|
||||
sourceVendorId: vendorId,
|
||||
price,
|
||||
currency: "USD",
|
||||
stockLevel: stock?.qty !== undefined && stock.qty > 0 ? "in_stock" :
|
||||
stock?.confidence === 1 ? "in_stock" : "on_request",
|
||||
stockLevel: sl,
|
||||
url,
|
||||
contentHash: hash,
|
||||
});
|
||||
@ -311,7 +313,7 @@ export async function scrapeNaddod(): Promise<void> {
|
||||
}
|
||||
} catch (err) {
|
||||
errors++;
|
||||
if (errors <= 10) console.warn(` Error for ${url}: ${(err as Error).message.slice(0, 70)}`);
|
||||
if (errors <= 10) console.warn(` Error for ${url}: ${(err as Error).message.slice(0, 300)}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user