🎉 initial commit

This commit is contained in:
Marc Koch 2025-03-04 10:36:47 +01:00
commit c93a06972b
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9
27 changed files with 4189 additions and 0 deletions

View 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;
}
}

View file

@ -0,0 +1,32 @@
<?php
namespace Civi\Mailinglistsync\Exceptions;
/**
* A simple custom error indicating a problem with the validation of the
* BaseMailingList and its subclasses.
*/
class MailinglistException extends BaseException {
public const ERROR_CODE_PERMISSION_DENIED = 'permission_denied';
public const ERROR_CODE_UPDATE_EMAIL_ADDRESS_FAILED = 'update_email_address_failed';
public const ERROR_CODE_DELETE_EMAIL_ADDRESS_FAILED = 'delete_email_address_failed';
public const ERROR_CODE_GET_RECIPIENTS_FAILED = 'get_recipients_failed';
public const ERROR_CODE_GET_LOCATION_TYPES_FAILED = 'get_location_types_failed';
public const ERROR_CODE_INVALID_CLASS = 'invalid_class';
public const ERROR_CODE_INVALID_EMAIL_ADDRESS = 'invalid_email_address';
public const ERROR_CODE_GET_GROUP_MAILING_LISTS_FAILED = 'get_group_mailing_lists_failed';
public const ERROR_CODE_GET_AD_GROUP_MAILING_LISTS_FAILED = 'get_group_mailing_lists_failed';
public const ERROR_CODE_GET_EVENT_MAILING_LISTS_FAILED = 'get_event_mailing_lists_failed';
public const ERROR_CODE_GET_CONTACT_FAILED = 'get_contact_failed';
public const ERROR_CODE_CREATE_CONTACT_FAILED = 'create_contact_failed';
public const ERROR_CODE_MULTIPLE_CONTACTS_FOUND = 'multiple_contacts_found';
public const ERROR_CODE_INVALID_LOCATION_TYPE = 'invalid_location_type';
public const ERROR_CODE_GROUP_CREATION_FAILED = 'group_creation_failed';
public const ERROR_CODE_UPDATE_ENTITY_FAILED = 'update_entity_failed';
public const ERROR_CODE_MULTIPLE_RECIPIENTS = 'multiple_recipients';
}

View file

@ -0,0 +1,14 @@
<?php
namespace Civi\Mailinglistsync\Exceptions;
/**
* A simple custom error indicating a problem with the validation of the
* synchronization of mailing lists.
*/
class MailinglistSyncException extends BaseException {
public const ERROR_CODE_UNSERIALIZE_SINGLETON = 'unserialize_singleton';
}