From 604131b31db33602291b35b47eadf529d412a715 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sat, 28 Jun 2025 16:45:20 +0800 Subject: [PATCH] Use own exception --- src/SPC/util/toolchain/GccNativeToolchain.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/SPC/util/toolchain/GccNativeToolchain.php b/src/SPC/util/toolchain/GccNativeToolchain.php index c845d11d..b9882a9a 100644 --- a/src/SPC/util/toolchain/GccNativeToolchain.php +++ b/src/SPC/util/toolchain/GccNativeToolchain.php @@ -7,6 +7,7 @@ namespace SPC\util\toolchain; use SPC\builder\freebsd\SystemUtil as FreeBSDSystemUtil; use SPC\builder\linux\SystemUtil as LinuxSystemUtil; use SPC\builder\macos\SystemUtil as MacOSSystemUtil; +use SPC\exception\WrongUsageException; use SPC\util\GlobalEnvManager; class GccNativeToolchain implements ToolchainInterface @@ -23,9 +24,9 @@ class GccNativeToolchain implements ToolchainInterface { // check gcc exists match (PHP_OS_FAMILY) { - 'Linux' => LinuxSystemUtil::findCommand('g++') ?? throw new \RuntimeException('g++ not found, please install it or set CC/CXX to a valid path.'), - 'Darwin' => MacOSSystemUtil::findCommand('g++') ?? throw new \RuntimeException('g++ not found, please install it or set CC/CXX to a valid path.'), - 'BSD' => FreeBSDSystemUtil::findCommand('g++') ?? throw new \RuntimeException('g++ not found, please install it or set CC/CXX to a valid path.'), + 'Linux' => LinuxSystemUtil::findCommand('g++') ?? throw new WrongUsageException('g++ not found, please install it or set CC/CXX to a valid path.'), + 'Darwin' => MacOSSystemUtil::findCommand('g++') ?? throw new WrongUsageException('g++ not found, please install it or set CC/CXX to a valid path.'), + 'BSD' => FreeBSDSystemUtil::findCommand('g++') ?? throw new WrongUsageException('g++ not found, please install it or set CC/CXX to a valid path.'), default => throw new \RuntimeException('GCC is not supported on ' . PHP_OS_FAMILY . '.'), }; }