Fix error handling in loadUnmanagedContainers method

This commit is contained in:
Andras Bacsai 2024-04-02 15:01:50 +02:00
parent 75b9f4fcbf
commit 0f4eab3cf2
2 changed files with 5 additions and 6 deletions

View File

@ -42,7 +42,11 @@ public function refreshStatus() {
$this->dispatch('success', 'Resource statuses refreshed.');
}
public function loadUnmanagedContainers() {
$this->unmanagedContainers = $this->server->loadUnmanagedContainers();
try {
$this->unmanagedContainers = $this->server->loadUnmanagedContainers();
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
public function mount() {
$this->unmanagedContainers = collect();

View File

@ -550,7 +550,6 @@ public function startUnmanaged($id)
}
public function loadUnmanagedContainers()
{
try {
if ($this->isFunctional()) {
$containers = instant_remote_process(["docker ps -a --format '{{json .}}' "], $this);
$containers = format_docker_command_output_to_json($containers);
@ -566,10 +565,6 @@ public function loadUnmanagedContainers()
} else {
return collect([]);
}
} catch (\Throwable $e) {
return handleError($e);
}
}
public function hasDefinedResources()
{