Catch and display error on save_post action

WordPress post “saves” work by posting, processing, and redirecting back to the originating page. Put a die after your error and you should see your errors when appropriate. Without that, the page redirects before you see the error message.

In my opinion you would be better off turning on debugging and writing to the error log.

catch (Exception $e) {
    error_log($mySforceConnection->getLastRequest());
    error_log(echo $e->faultstring);
}

vancoder is correct that this is mostly a PHP problem, but given that I believe the issue to be related to WordPress’ post/process/redirect pattern I thought an answer was in order. If I am right, that should straighten out the confusion.

Also, save_post runs after most of the post data has been saved so if you need to interrupt the primary save this is not the hook.