Skip to content

Commit 604131b

Browse files
committed
Use own exception
1 parent 924da6a commit 604131b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/SPC/util/toolchain/GccNativeToolchain.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use SPC\builder\freebsd\SystemUtil as FreeBSDSystemUtil;
88
use SPC\builder\linux\SystemUtil as LinuxSystemUtil;
99
use SPC\builder\macos\SystemUtil as MacOSSystemUtil;
10+
use SPC\exception\WrongUsageException;
1011
use SPC\util\GlobalEnvManager;
1112

1213
class GccNativeToolchain implements ToolchainInterface
@@ -23,9 +24,9 @@ public function afterInit(string $target): void
2324
{
2425
// check gcc exists
2526
match (PHP_OS_FAMILY) {
26-
'Linux' => LinuxSystemUtil::findCommand('g++') ?? throw new \RuntimeException('g++ not found, please install it or set CC/CXX to a valid path.'),
27-
'Darwin' => MacOSSystemUtil::findCommand('g++') ?? throw new \RuntimeException('g++ not found, please install it or set CC/CXX to a valid path.'),
28-
'BSD' => FreeBSDSystemUtil::findCommand('g++') ?? throw new \RuntimeException('g++ not found, please install it or set CC/CXX to a valid path.'),
27+
'Linux' => LinuxSystemUtil::findCommand('g++') ?? throw new WrongUsageException('g++ not found, please install it or set CC/CXX to a valid path.'),
28+
'Darwin' => MacOSSystemUtil::findCommand('g++') ?? throw new WrongUsageException('g++ not found, please install it or set CC/CXX to a valid path.'),
29+
'BSD' => FreeBSDSystemUtil::findCommand('g++') ?? throw new WrongUsageException('g++ not found, please install it or set CC/CXX to a valid path.'),
2930
default => throw new \RuntimeException('GCC is not supported on ' . PHP_OS_FAMILY . '.'),
3031
};
3132
}

0 commit comments

Comments
 (0)