Fix crm error log (#18105)

Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
This commit is contained in:
Hariom BalharaandUdit Takkar authored and GitHub committed 2024-12-12 13:15:14 +05:30
1 parent 13a90aba30
commit 1b82552e76
1 file changed
+3 -1
+3 -1
View File
@@ -979,7 +979,9 @@ export default class EventManager {
let success = true;
const createdEvent = await crm.createEvent(event, currentAppOption).catch((error) => {
success = false;
log.warn(`Error creating crm event for ${credential.type}`, JSON.stringify(error));
// We don't know the type of the error here, so for an Error instance we can read message but otherwise we stringify the error
let errorMsg = error instanceof Error ? error.message : JSON.stringify(error);
log.warn(`Error creating crm event for ${credential.type}`, errorMsg);
});
if (createdEvent) {