MinnPost / object-sync-for-salesforce

WordPress plugin that maps and syncs data between Salesforce objects and WordPress objects.
https://wordpress.org/plugins/object-sync-for-salesforce/
GNU General Public License v2.0
96 stars 52 forks source link

Improve error log when WP update fails #413

Closed jonathanstegall closed 3 years ago

jonathanstegall commented 3 years ago

Is your feature request related to a problem? Please describe. When a pull action is unable to update a WordPress record (for example, because it no longer exists) the log message title reads like this:

Error: WordPress update for user ID [ID number] was unsuccessful with these errors:

And then the log message reads like this:

WP_Error Object
(
[errors] => Array
(
[invalid_user_id] => Array
(
[0] => Invalid user ID.
)

)

[error_data] => Array
(
)

[additional_data:protected] => Array
(
)

)

The problem is that it's not clear what record in Salesforce caused the error to happen.

Describe the solution you'd like

I think either in the log title, in the log message, or both, we should show what Salesforce record was trying to do the pull operation. This way admins could go look in Salesforce for the record and see what to do with it.

I notice that this case also doesn't create a Mapping Error in the plugin admin. Maybe it should.

jonathanstegall commented 3 years ago

I think we could add all of the $params array to the message body and see what it contains. I can't remember if it has the Salesforce record ID, but at least it would have whatever info about the record the plugin is trying to save.

jonathanstegall commented 3 years ago

Closed in #417.