2022-05-10 00:30:33 +08:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
|
|
namespace ZM\Exception;
|
|
|
|
|
|
|
|
|
|
|
|
class ConfigException extends ZMException
|
|
|
|
|
|
{
|
2022-08-22 16:29:27 +08:00
|
|
|
|
public const UNSUPPORTED_FILE_TYPE = 'E00079';
|
|
|
|
|
|
|
|
|
|
|
|
public const LOAD_CONFIG_FAILED = 'E00080';
|
|
|
|
|
|
|
2022-11-03 10:18:17 +08:00
|
|
|
|
public function __construct($err_code, $message = '', $code = 0, \Throwable $previous = null)
|
2022-05-10 00:30:33 +08:00
|
|
|
|
{
|
|
|
|
|
|
parent::__construct(zm_internal_errcode($err_code) . $message, $code, $previous);
|
|
|
|
|
|
}
|
2022-08-22 16:29:27 +08:00
|
|
|
|
|
|
|
|
|
|
public static function unsupportedFileType(string $file_path): ConfigException
|
|
|
|
|
|
{
|
|
|
|
|
|
return new self(self::UNSUPPORTED_FILE_TYPE, "不支持的配置文件类型:{$file_path}");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static function loadConfigFailed(string $file_path, string $message): ConfigException
|
|
|
|
|
|
{
|
|
|
|
|
|
return new self(self::LOAD_CONFIG_FAILED, "加载配置文件失败:{$file_path},{$message}");
|
|
|
|
|
|
}
|
2022-05-10 00:30:33 +08:00
|
|
|
|
}
|