forked from HermanPeeren/releasemaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigurationError.php
More file actions
39 lines (32 loc) · 961 Bytes
/
ConfigurationError.php
File metadata and controls
39 lines (32 loc) · 961 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
* @package AkeebaReleaseMaker
* @copyright Copyright (c)2012-2021 Nicholas K. Dionysopoulos / Akeeba Ltd
* @license GNU General Public License version 3, or later
*/
namespace Akeeba\ReleaseMaker\Exception;
use Akeeba\ReleaseMaker\Contracts\ExceptionCode;
use RuntimeException;
use Throwable;
/**
* Configuration file error.
*
* @since 2.0.0
*/
class ConfigurationError extends RuntimeException implements ExitCodeSettingException
{
public function __construct(?string $message = null, ?int $code = null, Throwable $previous = null)
{
$message ??= "Configuration error";
$code ??= ExceptionCode::CONFIG_GENERIC_ERROR;
/**
* Since we implement ExitCodeSettingException we must clamp the code between 0 and 255 (valid exit codes, at
* least for *NIX systems).
*/
if (($code < 0) || ($code > 255))
{
$code = ExceptionCode::CONFIG_GENERIC_ERROR;;
}
parent::__construct($message, $code, $previous);
}
}