mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
Website: update logged warning in deliver-contact-form-message (#35695)
Closes: https://github.com/fleetdm/confidential/issues/13046 Changes: - Updated the logged warning in deliver-contact-form-message to include the full error thrown by the `build()` helper. - Added intercepts to the helpers called inside of the `build()` helper in deliver-contact-form-message, and updated it to throw an error if the updateOrCreateContactAndAccount helper does not return an account ID.
This commit is contained in:
parent
9b7f7ce8f1
commit
2cedc3e22e
1 changed files with 10 additions and 1 deletions
|
|
@ -116,7 +116,14 @@ Fleet Premium subscription details:
|
|||
lastName: lastName,
|
||||
contactSource: 'Website - Contact forms',
|
||||
description: `Sent a contact form message: ${message}`,
|
||||
}).intercept((err)=>{
|
||||
return new Error(`Could not create/update a contact or account. Full error: ${require('util').inspect(err)}`);
|
||||
});
|
||||
|
||||
// If the Contact record returned by the updateOrCreateContactAndAccount does not have a parent Account record, throw an error to stop the build helper.
|
||||
if(!recordIds.salesforceAccountId) {
|
||||
throw new Error(`Could not create historical event. The contact record (ID: ${recordIds.salesforceContactId}) returned by the updateOrCreateContactAndAccount helper is missing a parent account record.`);
|
||||
}
|
||||
// Create the new Fleet website page view record.
|
||||
await sails.helpers.salesforce.createHistoricalEvent.with({
|
||||
salesforceAccountId: recordIds.salesforceAccountId,
|
||||
|
|
@ -124,10 +131,12 @@ Fleet Premium subscription details:
|
|||
eventType: 'Intent signal',
|
||||
intentSignal: 'Submitted the "Send a message" form',
|
||||
eventContent: message,
|
||||
}).intercept((err)=>{
|
||||
return new Error(`Could not create an historical event. Full error: ${require('util').inspect(err)}`);
|
||||
});
|
||||
}).exec((err)=>{// Use .exec() to run the salesforce helpers in the background.
|
||||
if(err) {
|
||||
sails.log.warn(`Background task failed: When a user submitted a contact form message, a contact/account/historical event could not be created/updated in the CRM for this email address: ${emailAddress}.`, err);
|
||||
sails.log.warn(`Background task failed: When a user submitted a contact form message, a contact/account/historical event could not be created/updated in the CRM for this email address: ${emailAddress}. Full error: ${require('util').inspect(err)}`);
|
||||
}
|
||||
return;
|
||||
});//_∏_
|
||||
|
|
|
|||
Loading…
Reference in a new issue