🎉 initial commit
This commit is contained in:
commit
c93a06972b
27 changed files with 4189 additions and 0 deletions
53
Civi/Mailinglistsync/Exceptions/BaseException.php
Normal file
53
Civi/Mailinglistsync/Exceptions/BaseException.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace Civi\Mailinglistsync\Exceptions;
|
||||
|
||||
use CRM_Mailinglistsync_ExtensionUtil as E;
|
||||
|
||||
/**
|
||||
* A simple custom exception class that indicates a problem within a class
|
||||
* of the de.propeace.mailinglist extension.
|
||||
*/
|
||||
class BaseException extends \CRM_Core_Exception {
|
||||
|
||||
/**
|
||||
* @var int|string
|
||||
*/
|
||||
protected $code;
|
||||
|
||||
protected string $log_message;
|
||||
|
||||
/**
|
||||
* BaseException Constructor
|
||||
*
|
||||
* @param string $message
|
||||
* Error message
|
||||
* @param string $error_code
|
||||
* A meaningful error code
|
||||
*/
|
||||
public function __construct(string $message = '', string $error_code = '') {
|
||||
parent::__construct($message, 1);
|
||||
$this->log_message = !empty($message) ? E::LONG_NAME . ': ' . $message : '';
|
||||
$this->code = $error_code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the error message, but with the extension name prefixed.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLogMessage(): string {
|
||||
return $this->log_message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the error code.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getErrorCode(): string {
|
||||
return $this->code;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue