Skip to content
Snippets Groups Projects
Commit 80e4f7b6 authored by Aaron Bauman's avatar Aaron Bauman
Browse files

Merge branch '8.x-3.x' into push-cron

* 8.x-3.x:
  Add watchdog_exception() wherever appropriate

Conflicts:
	modules/salesforce_mapping/salesforce_mapping.module
	src/Rest/RestClient.php
parents 5752f87c abc4bb79
No related branches found
No related tags found
No related merge requests found
......@@ -393,6 +393,7 @@ class MappedObject extends RevisionableContentEntityBase implements MappedObject
$value = $this->sf_object->field($field->get('salesforce_field'));
}
catch (Exception $e) {
// Field missing from SObject? Skip it.
continue;
}
......@@ -402,7 +403,6 @@ class MappedObject extends RevisionableContentEntityBase implements MappedObject
}
catch (\Exception $e) {
$message = t();
// throw new \Exception($message, $e->getCode(), $e);
\Drupal::logger('Salesforce Pull')->notice('Exception during pull for @sfobj.@sffield @sfid to @dobj.@dprop @did with value @v: @e', [
'@sfobj' => $mapping->getSalesforceObjectType(),
'@sffield' => $sf_field,
......@@ -413,6 +413,7 @@ class MappedObject extends RevisionableContentEntityBase implements MappedObject
'@v' => $value,
'@e' => $e->getMessage(),
]);
watchdog_exception(__CLASS__, $e);
continue;
}
}
......
......@@ -106,6 +106,7 @@ class MappedObjectForm extends ContentEntityForm {
$mapped_object->push();
}
catch (Exception $e) {
watchdog_exception(__CLASS__, $e);
drupal_set_message(t('Push failed with an exception: %exception', array('%exception' => $e->getMessage())), 'error');
return;
}
......
......@@ -397,7 +397,7 @@ abstract class SalesforceMappingFormCrudBase extends SalesforceMappingFormBase {
}
}
catch (\Exception $e) {
// noop
// No record type info means nothing for us to do.
}
return $sf_types;
}
......@@ -434,6 +434,7 @@ abstract class SalesforceMappingFormCrudBase extends SalesforceMappingFormBase {
$describe = $this->get_salesforce_object();
}
catch (Exception $e) {
// No describe results means no datetime fields. We're done.
return [];
}
......
......@@ -79,6 +79,7 @@ class RelatedProperties extends SalesforceMappingFieldPluginBase {
}
catch (Exception $e) {
// @TODO something about this exception
watchdog_exception(__CLASS__, $e);
return;
}
......
......@@ -73,13 +73,8 @@ class DeleteHandler {
$mapped_objects = salesforce_mapped_object_load_by_sfid($record['id']);
}
catch (Exception $e) {
// @TODO do we need a log entry for every object which gets deleted and isn't mapped to Drupal?
\Drupal::logger('Salesforce Pull')->notice(
'No mapped object exists for Salesforce Object ID: %sfid',
[
'%sfid' => $record['id'],
]
);
// We do not need to know about every object which gets deleted in SF and
// isn't mapped to Drupal.
return;
}
......@@ -138,7 +133,7 @@ class DeleteHandler {
);
}
catch (Exception $e) {
\Drupal::logger('Salesforce Pull')->error($e);
watchdog_exception(__CLASS__, $e);
// If mapped entity couldn't be deleted, do not delete the mapped object either.
continue;
}
......
......@@ -123,6 +123,7 @@ abstract class PullBase extends QueueWorkerBase {
]
);
\Drupal::logger('Salesforce Pull')->error($message);
watchdog_exception(__CLASS__, $e);
}
}
......@@ -205,6 +206,7 @@ abstract class PullBase extends QueueWorkerBase {
]
);
\Drupal::logger('Salesforce Pull')->error($message);
watchdog_exception(__CLASS__, $e);
}
}
......
......@@ -114,7 +114,7 @@ class QueueHandler {
return $this->sfapi->query($soql);
}
catch (Exception $e) {
\Drupal::logger('Salesforce Pull')->error($e->getMessage());
watchdog_exception(__CLASS__, $e);
}
}
......@@ -134,7 +134,7 @@ class QueueHandler {
$this->handleLargeRequests($mapping, $new_result);
}
catch (Exception $e) {
\Drupal::logger('Salesforce Pull')->error($e->getMessage());
watchdog_exception(__CLASS__, $e);
}
}
}
......@@ -152,7 +152,7 @@ class QueueHandler {
}
}
catch (Exception $e) {
\Drupal::logger('Salesforce Pull')->error($e->getMessage());
watchdog_exception(__CLASS__, $e);
}
}
}
......@@ -2,7 +2,7 @@
namespace Drupal\salesforce\Form;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\RequestException;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
......@@ -119,7 +119,8 @@ class AuthorizeForm extends ConfigFormBase {
'#theme' => 'item_list',
];
}
catch (ClientException $e) {
catch (RequestException $e) {
watchdog_exception(__CLASS__, $e);
salesforce_set_message($e->getMessage(), 'warning');
}
}
......@@ -153,8 +154,9 @@ class AuthorizeForm extends ConfigFormBase {
);
$response->send();
}
catch (ClientException $e) {
// Set form error.
catch (RequestException $e) {
drupal_set_message(t("Error during authorization: %message", $e->getMessage()), 'error');
watchdog_exception(__CLASS__, $e);
}
parent::submitForm($form, $form_state);
......
......@@ -90,7 +90,6 @@ class RestClient {
catch (RequestException $e) {
// RequestException gets thrown for any response status but 2XX.
$this->response = $e->getResponse();
switch ($this->response->getStatusCode()) {
case 401:
// The session ID or OAuth token used has expired or is invalid: refresh
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment