56 lines
1.8 KiB
PHP
56 lines
1.8 KiB
PHP
<?php
|
|
|
|
/*
|
|
* SPDX-FileCopyrightText: Copyright 2020 - 2026 grommunio GmbH
|
|
* SPDX-FileCopyrightText: Copyright 2016 Kopano and its licensors
|
|
* SPDX-FileCopyrightText: Copyright 2005 - 2016 Zarafa B.V. and its licensors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
/**
|
|
* Defines an exception class for all php Errors.
|
|
* ErrorException properties and methods http://php.net/manual/en/class.errorexception.php
|
|
* Exception properties and methods http://www.php.net/manual/en/class.exception.php.
|
|
*/
|
|
class GrommunioErrorException extends BaseException {
|
|
/**
|
|
* Constructs the Exception.
|
|
*
|
|
* @param string $errorMessage The exception message
|
|
* @param int $code The Exception code
|
|
* @param string $filename the filename where the exception is thrown
|
|
* @param int $lineno the line number where the exception is thrown
|
|
* @param mixed $errorContext
|
|
* @param null|string $displayMessage the exception message to show at client side
|
|
*/
|
|
public function __construct($errorMessage, $code, $filename, $lineno, protected $errorContext = null, $displayMessage = null) {
|
|
if (!$displayMessage) {
|
|
$displayMessage = _('Action is not performed correctly.');
|
|
}
|
|
|
|
parent::__construct($errorMessage, $code, null, $displayMessage);
|
|
$this->setFile($filename);
|
|
$this->setLineNo($lineno);
|
|
}
|
|
|
|
/**
|
|
* Function sets the filename where the exception was thrown.
|
|
*
|
|
* @param string $filename name of the file where the exception was thrown
|
|
*/
|
|
protected function setFile($filename = '') {
|
|
$this->file = $filename;
|
|
}
|
|
|
|
/**
|
|
* Function sets the line where the exception was thrown.
|
|
*
|
|
* @param int $lineno line number where the exception was thrown
|
|
*/
|
|
protected function setLineNo($lineno = 0) {
|
|
$this->line = $lineno;
|
|
}
|
|
}
|
|
|
|
class_alias(GrommunioErrorException::class, 'ZarafaErrorException');
|