fix messed up merge conflicts

This commit is contained in:
Marc Michalsky 2024-04-05 16:08:44 +02:00 committed by Jens Schuppe
parent 1fc6529064
commit ac892c9afc
6 changed files with 19 additions and 129 deletions

View file

@ -1,4 +1,21 @@
<?php
/*
* Copyright (C) 2024 SYSTOPIA GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation in version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types = 1);
namespace Civi\Twingle\Exceptions;

View file

@ -1,67 +0,0 @@
<?php
/*
* Copyright (C) 2024 SYSTOPIA GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation in version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types = 1);
namespace Civi\Twingle\Exceptions;
use CRM_Twingle_ExtensionUtil as E;
/**
* A simple custom exception class that indicates a problem within a class
* of the Twingle API extension.
*/
class BaseException extends \Exception {
/**
* @var string
*/
protected $code;
protected string $log_message;
/**
* BaseException Constructor
* @param string $message
* Error message
* @param string $error_code
* A meaningful error code
* @param \Throwable $previous
* A previously thrown exception to include.
*/
public function __construct(string $message = '', string $error_code = '', \Throwable $previous = NULL) {
parent::__construct($message, 1, $previous);
$this->log_message = '' !== $message ? E::LONG_NAME . ': ' . $message : '';
$this->code = $error_code;
}
/**
* Returns the error message, but with the extension name prefixed.
* @return string
*/
public function getLogMessage() {
return $this->log_message;
}
/**
* Returns the error code.
* @return string
*/
public function getErrorCode() {
return $this->code;
}
}

View file

@ -1,18 +0,0 @@
<?php
namespace Civi\Twingle\Exceptions;
/**
* A simple custom exception that indicates a problem within the
* CRM_Twingle_Profile class
*/
class ProfileException extends BaseException {
public const ERROR_CODE_PROFILE_NOT_FOUND = 'profile_not_found';
public const ERROR_CODE_DEFAULT_PROFILE_NOT_FOUND = 'default_profile_not_found';
public const ERROR_CODE_COULD_NOT_SAVE_PROFILE = 'could_not_save_profile';
public const ERROR_CODE_COULD_NOT_RESET_PROFILE = 'could_not_reset_profile';
public const ERROR_CODE_COULD_NOT_DELETE_PROFILE = 'could_not_delete_profile';
public const ERROR_CODE_UNKNOWN_PROFILE_ATTRIBUTE = 'unknown_profile_attribute';
}

View file

@ -38,13 +38,8 @@ class ProfileValidationError extends BaseException {
* @param string $error_code
* A meaningful error code
*/
public function __construct(
string $affected_field_name,
string $message = '',
string $error_code = '',
?\Throwable $previous = NULL
) {
parent::__construct($message, $error_code, $previous);
public function __construct(string $affected_field_name, string $message = '', string $error_code = '') {
parent::__construct($message, $error_code);
$this->affected_field_name = $affected_field_name;
}

View file

@ -1,37 +0,0 @@
<?php
namespace Civi\Twingle\Exceptions;
/**
* A simple custom error indicating a problem with the validation of the
* CRM_Twingle_Profile
*/
class ProfileValidationError extends BaseException {
private string $affected_field_name;
public const ERROR_CODE_PROFILE_VALIDATION_FAILED = 'profile_validation_failed';
public const ERROR_CODE_PROFILE_VALIDATION_WARNING = 'profile_validation_warning';
/**
* ProfileValidationError Constructor
* @param string $affected_field_name
* The name of the profile field which caused the exception
* @param string $message
* Error message
* @param string $error_code
* A meaningful error code
*/
public function __construct(string $affected_field_name, string $message = '', string $error_code = '') {
parent::__construct($message, $error_code);
$this->affected_field_name = $affected_field_name;
}
/**
* Returns the name of the profile field that caused the exception.
* @return string
*/
public function getAffectedFieldName() {
return $this->affected_field_name;
}
}