Refactor all (except command) modules using new exceptions

This commit is contained in:
crazywhalecc
2025-08-06 20:43:23 +08:00
committed by Jerry Ma
parent 722bb31815
commit f68f060be2
47 changed files with 335 additions and 291 deletions

View File

@@ -4,6 +4,8 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\BuildFailureException;
trait fastlz
{
protected function build(): void
@@ -13,10 +15,10 @@ trait fastlz
->exec((getenv('AR') ?: 'ar') . ' rcs libfastlz.a fastlz.o');
if (!copy($this->source_dir . '/fastlz.h', BUILD_INCLUDE_PATH . '/fastlz.h')) {
throw new \RuntimeException('Failed to copy fastlz.h');
throw new BuildFailureException('Failed to copy fastlz.h, file does not exist');
}
if (!copy($this->source_dir . '/libfastlz.a', BUILD_LIB_PATH . '/libfastlz.a')) {
throw new \RuntimeException('Failed to copy libfastlz.a');
throw new BuildFailureException('Failed to copy libfastlz.a, file does not exist');
}
}
}

View File

@@ -5,8 +5,8 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\builder\linux\library\LinuxLibraryBase;
use SPC\exception\BuildFailureException;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
use SPC\util\SPCTarget;
@@ -60,7 +60,7 @@ trait postgresql
$envs .= " LIBS=\"{$libs}{$libcpp}\" ";
}
if ($error_exec_cnt > 0) {
throw new RuntimeException('Failed to get pkg-config information!');
throw new BuildFailureException('Failed to get pkg-config information!');
}
FileSystem::resetDir($this->source_dir . '/build');
@@ -74,7 +74,7 @@ trait postgresql
->exec('sed -i.backup "278 s/^/# /" ../src/Makefile.shlib')
->exec('sed -i.backup "402 s/^/# /" ../src/Makefile.shlib');
} else {
throw new RuntimeException('Unsupported version for postgresql: ' . $version . ' !');
throw new BuildFailureException('Unsupported version for postgresql: ' . $version . ' !');
}
// configure