Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Fix error handling in loadUnmanagedContainers method

Andras Bacsai0f4eab3cf2ec
diff --git a/app/Livewire/Server/Resources.php b/app/Livewire/Server/Resources.php
index f781418d92..1c8a8267e1 100644
--- a/app/Livewire/Server/Resources.php
+++ b/app/Livewire/Server/Resources.php
@@ -42,7 +42,11 @@ class Resources extends Component
$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();
diff --git a/app/Models/Server.php b/app/Models/Server.php
index 10af2915d8..cbe895936c 100644
--- a/app/Models/Server.php
+++ b/app/Models/Server.php
@@ -550,7 +550,6 @@ $schema://$host {
}
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 @@ $schema://$host {
} else {
return collect([]);
}
- } catch (\Throwable $e) {
- return handleError($e);
- }
-
}
public function hasDefinedResources()
{