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

@@ -6,7 +6,8 @@ declare(strict_types=1);
namespace SPC\store;
use SPC\exception\RuntimeException;
use SPC\exception\InterruptException;
use SPC\exception\SPCInternalException;
function f_exec(string $command, mixed &$output, mixed &$result_code): bool
{
@@ -52,13 +53,13 @@ function f_passthru(string $cmd): bool
{
if (str_starts_with($cmd, 'git')) {
if (str_contains($cmd, '--branch "SIGINT"')) {
throw new RuntimeException('Interrupt', 2);
throw new InterruptException('interrupted', 2);
}
return true;
}
if (str_contains($cmd, 'https://fakecmd.com/curlDown')) {
if (str_contains($cmd, 'SIGINT')) {
throw new RuntimeException('Interrupt', 2);
throw new InterruptException('interrupted', 2);
}
return true;
}
@@ -71,5 +72,5 @@ function f_passthru(string $cmd): bool
return true;
}
}
throw new RuntimeException('Invalid tests');
throw new SPCInternalException('Invalid tests');
}