abstract class SalesforceExceptionEvent in Salesforce Suite 8.3
Same name and namespace in other branches
- 8.4 src/Event/SalesforceExceptionEvent.php \Drupal\salesforce\Event\SalesforceExceptionEvent
- 5.0.x src/Event/SalesforceExceptionEvent.php \Drupal\salesforce\Event\SalesforceExceptionEvent
Base class for Salesforce Exception events, primarily for logging.
Hierarchy
- class \Drupal\salesforce\Event\SalesforceBaseEvent extends \Symfony\Component\EventDispatcher\Event
- class \Drupal\salesforce\Event\SalesforceExceptionEvent implements SalesforceExceptionEventInterface
Expanded class hierarchy of SalesforceExceptionEvent
File
- src/
Event/ SalesforceExceptionEvent.php, line 8
Namespace
Drupal\salesforce\EventView source
abstract class SalesforceExceptionEvent extends SalesforceBaseEvent implements SalesforceExceptionEventInterface {
/**
* Exception.
*
* @var \Exception|null
*/
protected $exception;
/**
* Message for logging.
*
* @var string
*/
protected $message;
/**
* Context, for t() translation.
*
* @var array
*/
protected $context;
/**
* Event level: notice, warning, or error.
*
* @var string
*/
protected $level;
/**
* SalesforceExceptionEvent constructor.
*
* @param string $level
* Values are RfcLogLevel::NOTICE, RfcLogLevel::WARNING, RfcLogLevel::ERROR.
* @param \Exception|null $e
* A related Exception, if available.
* @param string $message
* The translatable message string, suitable for t().
* @param array $context
* Parameter array suitable for t(), to be translated for $message.
*/
public function __construct($level, \Exception $e = NULL, $message = '', array $context = []) {
$this->exception = $e;
$this->level = $level;
$this->message = $message;
$this->context = $context;
}
/**
* {@inheritdoc}
*/
public function getException() {
return $this->exception;
}
/**
* {@inheritdoc}
*/
public function getLevel() {
return $this->level;
}
/**
* {@inheritdoc}
*/
public function getMessage() {
if ($this->message) {
return $this->message;
}
elseif ($this->exception && $this->exception
->getMessage()) {
return $this->exception
->getMessage();
}
else {
return 'Unknown Salesforce event.';
}
}
/**
* {@inheritdoc}
*/
public function getContext() {
return $this->context;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SalesforceExceptionEvent:: |
protected | property | Context, for t() translation. | |
SalesforceExceptionEvent:: |
protected | property | Exception. | |
SalesforceExceptionEvent:: |
protected | property | Event level: notice, warning, or error. | |
SalesforceExceptionEvent:: |
protected | property | Message for logging. | |
SalesforceExceptionEvent:: |
public | function |
Getter for message context. Overrides SalesforceExceptionEventInterface:: |
|
SalesforceExceptionEvent:: |
public | function |
Getter for exception. Overrides SalesforceExceptionEventInterface:: |
|
SalesforceExceptionEvent:: |
public | function |
Getter for log level. Overrides SalesforceExceptionEventInterface:: |
|
SalesforceExceptionEvent:: |
public | function |
Getter for message string. Overrides SalesforceExceptionEventInterface:: |
|
SalesforceExceptionEvent:: |
public | function | SalesforceExceptionEvent constructor. | 3 |