2022-05-10 00:30:33 +08:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
|
|
namespace ZM\Exception;
|
|
|
|
|
|
|
|
|
|
|
|
class ConfigException extends ZMException
|
|
|
|
|
|
{
|
2022-11-15 21:48:46 +08:00
|
|
|
|
public const UNSUPPORTED_FILE_TYPE = 79;
|
2022-08-22 16:29:27 +08:00
|
|
|
|
|
2022-11-15 21:48:46 +08:00
|
|
|
|
public const LOAD_CONFIG_FAILED = 80;
|
2022-08-22 16:29:27 +08:00
|
|
|
|
|
|
|
|
|
|
public static function unsupportedFileType(string $file_path): ConfigException
|
|
|
|
|
|
{
|
2022-12-27 20:39:24 +08:00
|
|
|
|
return new self("不支持的配置文件类型:{$file_path}", self::UNSUPPORTED_FILE_TYPE);
|
2022-08-22 16:29:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static function loadConfigFailed(string $file_path, string $message): ConfigException
|
|
|
|
|
|
{
|
2022-12-27 20:39:24 +08:00
|
|
|
|
return new self("加载配置文件失败:{$file_path},{$message}", self::LOAD_CONFIG_FAILED);
|
2022-08-22 16:29:27 +08:00
|
|
|
|
}
|
2022-05-10 00:30:33 +08:00
|
|
|
|
}
|