Error handling

This commit is contained in:
Kiran K 2023-11-27 13:17:09 +05:30
parent e08671161d
commit 681cf9537e
1 changed files with 10 additions and 14 deletions

View File

@ -58,26 +58,22 @@ const reportEvent = async ({ action, crud, group, actor, description, productId
// Find team info for the product
if (productId && !group) {
try {
const product = await productController.get(productId);
const product = await productController.get(productId);
retracedEvent.group = {
id: product.teamId,
name: product.teamName,
};
retracedEvent.group = {
id: product.teamId,
name: product.teamName,
};
retracedEvent.target = {
id: product.id,
name: product.name,
};
} catch (err: any) {
console.error('Error getting product info. Event not reported to Retraced.', err);
}
retracedEvent.target = {
id: product.id,
name: product.name,
};
}
await retracedClient.reportEvent(retracedEvent);
} catch (error: any) {
console.error(error);
console.error('Error reporting event to Retraced', error);
}
};