refactor(error-handling): replace generic Exception with RuntimeException for improved error specificity

This commit is contained in:
Andras Bacsai
2025-05-29 10:49:55 +02:00
parent 0369909408
commit 2361c34a53
3 changed files with 5 additions and 5 deletions

View File

@@ -53,7 +53,7 @@ class DeleteService
instant_remote_process(["docker rm -f $service->uuid"], $server, throwError: false); instant_remote_process(["docker rm -f $service->uuid"], $server, throwError: false);
} catch (\Exception $e) { } catch (\Exception $e) {
throw new \Exception($e->getMessage()); throw new \RuntimeException($e->getMessage());
} finally { } finally {
if ($deleteConfigurations) { if ($deleteConfigurations) {
$service->deleteConfigurations(); $service->deleteConfigurations();

View File

@@ -1289,7 +1289,7 @@ class Application extends BaseModel
try { try {
$yaml = Yaml::parse($this->docker_compose_raw); $yaml = Yaml::parse($this->docker_compose_raw);
} catch (\Exception $e) { } catch (\Exception $e) {
throw new \Exception($e->getMessage()); throw new \RuntimeException($e->getMessage());
} }
$services = data_get($yaml, 'services'); $services = data_get($yaml, 'services');

View File

@@ -599,7 +599,7 @@ function getTopLevelNetworks(Service|Application $resource)
try { try {
$yaml = Yaml::parse($resource->docker_compose_raw); $yaml = Yaml::parse($resource->docker_compose_raw);
} catch (\Exception $e) { } catch (\Exception $e) {
throw new \Exception($e->getMessage()); throw new \RuntimeException($e->getMessage());
} }
$services = data_get($yaml, 'services'); $services = data_get($yaml, 'services');
$topLevelNetworks = collect(data_get($yaml, 'networks', [])); $topLevelNetworks = collect(data_get($yaml, 'networks', []));
@@ -653,7 +653,7 @@ function getTopLevelNetworks(Service|Application $resource)
try { try {
$yaml = Yaml::parse($resource->docker_compose_raw); $yaml = Yaml::parse($resource->docker_compose_raw);
} catch (\Exception $e) { } catch (\Exception $e) {
throw new \Exception($e->getMessage()); throw new \RuntimeException($e->getMessage());
} }
$server = $resource->destination->server; $server = $resource->destination->server;
$topLevelNetworks = collect(data_get($yaml, 'networks', [])); $topLevelNetworks = collect(data_get($yaml, 'networks', []));
@@ -1435,7 +1435,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
try { try {
$yaml = Yaml::parse($resource->docker_compose_raw); $yaml = Yaml::parse($resource->docker_compose_raw);
} catch (\Exception $e) { } catch (\Exception $e) {
throw new \Exception($e->getMessage()); throw new \RuntimeException($e->getMessage());
} }
$allServices = get_service_templates(); $allServices = get_service_templates();
$topLevelVolumes = collect(data_get($yaml, 'volumes', [])); $topLevelVolumes = collect(data_get($yaml, 'volumes', []));