From f6a336e840aa728415b5019443f43f57ae337daf Mon Sep 17 00:00:00 2001 From: aaronbauman <aaronbauman@384578.no-reply.drupal.org> Date: Wed, 13 Mar 2019 14:44:39 -0400 Subject: [PATCH] Issue #2972602 by AaronBauman, acrosman: Salesforce logs empty, no title --- .../src/EventSubscriber/SalesforceLoggerSubscriber.php | 5 +++-- src/Event/SalesforceExceptionEvent.php | 10 +++++++++- src/Event/SalesforceExceptionEventInterface.php | 4 +--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/modules/salesforce_logger/src/EventSubscriber/SalesforceLoggerSubscriber.php b/modules/salesforce_logger/src/EventSubscriber/SalesforceLoggerSubscriber.php index e8b23b98..2cafe019 100644 --- a/modules/salesforce_logger/src/EventSubscriber/SalesforceLoggerSubscriber.php +++ b/modules/salesforce_logger/src/EventSubscriber/SalesforceLoggerSubscriber.php @@ -65,8 +65,9 @@ class SalesforceLoggerSubscriber implements EventSubscriberInterface { if ($exception) { $this->logger->log($event->getLevel(), self::EXCEPTION_MESSAGE_PLACEHOLDER, Error::decodeException($exception)); } - - $this->logger->log($event->getLevel(), $event->getMessage(), $event->getContext()); + else { + $this->logger->log($event->getLevel(), $event->getMessage(), $event->getContext()); + } } } diff --git a/src/Event/SalesforceExceptionEvent.php b/src/Event/SalesforceExceptionEvent.php index 7ce37441..f7e1f888 100644 --- a/src/Event/SalesforceExceptionEvent.php +++ b/src/Event/SalesforceExceptionEvent.php @@ -72,7 +72,15 @@ abstract class SalesforceExceptionEvent extends SalesforceBaseEvent implements S * {@inheritdoc} */ public function getMessage() { - return $this->message; + if ($this->message) { + return $this->message; + } + elseif ($this->exception && $this->exception->getMessage()) { + return $this->exception->getMessage(); + } + else { + return 'Unknown Salesforce event.'; + } } /** diff --git a/src/Event/SalesforceExceptionEventInterface.php b/src/Event/SalesforceExceptionEventInterface.php index 90110c2b..3d1bedf9 100644 --- a/src/Event/SalesforceExceptionEventInterface.php +++ b/src/Event/SalesforceExceptionEventInterface.php @@ -28,9 +28,7 @@ interface SalesforceExceptionEventInterface { * Getter for message string. * * @return string - * The formatted message for this event. (Note: to get the Exception - * message, use ::getExceptionMessage()). If no message was given, - * FormattableMarkup will be an empty string. + * The message for this event, or a default message. */ public function getMessage(); -- GitLab