Remove all useless catch block useless variables.
This commit is contained in:
@@ -34,7 +34,7 @@ class Discord extends Component
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->submit();
|
$this->submit();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
$this->team->discord_enabled = false;
|
$this->team->discord_enabled = false;
|
||||||
$this->validate();
|
$this->validate();
|
||||||
}
|
}
|
||||||
|
@@ -41,7 +41,7 @@ class Telegram extends Component
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->submit();
|
$this->submit();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
$this->team->telegram_enabled = false;
|
$this->team->telegram_enabled = false;
|
||||||
$this->validate();
|
$this->validate();
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,7 @@ class Form extends Component
|
|||||||
$url = Url::fromString($firstFqdn);
|
$url = Url::fromString($firstFqdn);
|
||||||
$host = $url->getHost();
|
$host = $url->getHost();
|
||||||
$this->preview_url_template = str($this->application->preview_url_template)->replace('{{domain}}', $host);
|
$this->preview_url_template = str($this->application->preview_url_template)->replace('{{domain}}', $host);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception) {
|
||||||
$this->dispatch('error', 'Invalid FQDN.');
|
$this->dispatch('error', 'Invalid FQDN.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -130,7 +130,7 @@ class BackupExecutions extends Component
|
|||||||
$dateObj = new \DateTime($date);
|
$dateObj = new \DateTime($date);
|
||||||
try {
|
try {
|
||||||
$dateObj->setTimezone(new \DateTimeZone($serverTimezone));
|
$dateObj->setTimezone(new \DateTimeZone($serverTimezone));
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception) {
|
||||||
$dateObj->setTimezone(new \DateTimeZone('UTC'));
|
$dateObj->setTimezone(new \DateTimeZone('UTC'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -95,7 +95,7 @@ class Database extends Component
|
|||||||
$this->database->save();
|
$this->database->save();
|
||||||
updateCompose($this->database);
|
updateCompose($this->database);
|
||||||
$this->dispatch('success', 'Database saved.');
|
$this->dispatch('success', 'Database saved.');
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
} finally {
|
} finally {
|
||||||
$this->dispatch('generateDockerCompose');
|
$this->dispatch('generateDockerCompose');
|
||||||
}
|
}
|
||||||
|
@@ -76,7 +76,7 @@ class Navbar extends Component
|
|||||||
} else {
|
} else {
|
||||||
$this->isDeploymentProgress = false;
|
$this->isDeploymentProgress = false;
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
$this->isDeploymentProgress = false;
|
$this->isDeploymentProgress = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -65,7 +65,7 @@ class Executions extends Component
|
|||||||
$dateObj = new \DateTime($date);
|
$dateObj = new \DateTime($date);
|
||||||
try {
|
try {
|
||||||
$dateObj->setTimezone(new \DateTimeZone($serverTimezone));
|
$dateObj->setTimezone(new \DateTimeZone($serverTimezone));
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception) {
|
||||||
$dateObj->setTimezone(new \DateTimeZone('UTC'));
|
$dateObj->setTimezone(new \DateTimeZone('UTC'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -28,7 +28,7 @@ class Show extends Component
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->private_key = PrivateKey::ownedByCurrentTeam(['name', 'description', 'private_key', 'is_git_related'])->whereUuid(request()->private_key_uuid)->firstOrFail();
|
$this->private_key = PrivateKey::ownedByCurrentTeam(['name', 'description', 'private_key', 'is_git_related'])->whereUuid(request()->private_key_uuid)->firstOrFail();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -43,7 +43,7 @@ class Advanced extends Component
|
|||||||
$this->server = Server::ownedByCurrentTeam()->whereUuid($server_uuid)->firstOrFail();
|
$this->server = Server::ownedByCurrentTeam()->whereUuid($server_uuid)->firstOrFail();
|
||||||
$this->parameters = get_route_parameters();
|
$this->parameters = get_route_parameters();
|
||||||
$this->syncData();
|
$this->syncData();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
return redirect()->route('server.show');
|
return redirect()->route('server.show');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,7 @@ class Invitations extends Component
|
|||||||
$initiation_found->delete();
|
$initiation_found->delete();
|
||||||
$this->refreshInvitations();
|
$this->refreshInvitations();
|
||||||
$this->dispatch('success', 'Invitation revoked.');
|
$this->dispatch('success', 'Invitation revoked.');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception) {
|
||||||
return $this->dispatch('error', 'Invitation not found.');
|
return $this->dispatch('error', 'Invitation not found.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -67,7 +67,7 @@ function format_docker_command_output_to_json($rawOutput): Collection
|
|||||||
return $outputLines
|
return $outputLines
|
||||||
->reject(fn ($line) => empty($line))
|
->reject(fn ($line) => empty($line))
|
||||||
->map(fn ($outputLine) => json_decode($outputLine, true, flags: JSON_THROW_ON_ERROR));
|
->map(fn ($outputLine) => json_decode($outputLine, true, flags: JSON_THROW_ON_ERROR));
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
return collect([]);
|
return collect([]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,7 +104,7 @@ function format_docker_envs_to_json($rawOutput)
|
|||||||
|
|
||||||
return [$env[0] => $env[1]];
|
return [$env[0] => $env[1]];
|
||||||
});
|
});
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
return collect([]);
|
return collect([]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -510,7 +510,7 @@ function fqdnLabelsForTraefik(string $uuid, Collection $domains, bool $is_force_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -124,7 +124,7 @@ function decode_remote_command_output(?ApplicationDeploymentQueue $application_d
|
|||||||
associative: true,
|
associative: true,
|
||||||
flags: JSON_THROW_ON_ERROR
|
flags: JSON_THROW_ON_ERROR
|
||||||
);
|
);
|
||||||
} catch (\JsonException $exception) {
|
} catch (\JsonException) {
|
||||||
return collect([]);
|
return collect([]);
|
||||||
}
|
}
|
||||||
$seenCommands = collect();
|
$seenCommands = collect();
|
||||||
@@ -204,7 +204,7 @@ function checkRequiredCommands(Server $server)
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
instant_remote_process(["docker run --rm --privileged --net=host --pid=host --ipc=host --volume /:/host busybox chroot /host bash -c 'apt update && apt install -y {$command}'"], $server);
|
instant_remote_process(["docker run --rm --privileged --net=host --pid=host --ipc=host --volume /:/host busybox chroot /host bash -c 'apt update && apt install -y {$command}'"], $server);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$commandFound = instant_remote_process(["docker run --rm --privileged --net=host --pid=host --ipc=host --volume /:/host busybox chroot /host bash -c 'command -v {$command}'"], $server, false);
|
$commandFound = instant_remote_process(["docker run --rm --privileged --net=host --pid=host --ipc=host --volume /:/host busybox chroot /host bash -c 'command -v {$command}'"], $server, false);
|
||||||
|
@@ -172,7 +172,7 @@ function get_latest_sentinel_version(): string
|
|||||||
$versions = $response->json();
|
$versions = $response->json();
|
||||||
|
|
||||||
return data_get($versions, 'coolify.sentinel.version');
|
return data_get($versions, 'coolify.sentinel.version');
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
return '0.0.0';
|
return '0.0.0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -301,7 +301,7 @@ function getFqdnWithoutPort(string $fqdn)
|
|||||||
$path = $url->getPath();
|
$path = $url->getPath();
|
||||||
|
|
||||||
return "$scheme://$host$path";
|
return "$scheme://$host$path";
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
return $fqdn;
|
return $fqdn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -540,7 +540,7 @@ function get_service_templates(bool $force = false): Collection
|
|||||||
$services = $response->json();
|
$services = $response->json();
|
||||||
|
|
||||||
return collect($services);
|
return collect($services);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable) {
|
||||||
$services = File::get(base_path('templates/service-templates.json'));
|
$services = File::get(base_path('templates/service-templates.json'));
|
||||||
|
|
||||||
return collect(json_decode($services))->sortKeys();
|
return collect(json_decode($services))->sortKeys();
|
||||||
@@ -1052,7 +1052,7 @@ function validate_dns_entry(string $fqdn, Server $server)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ray("Found match: $found_matching_ip");
|
ray("Found match: $found_matching_ip");
|
||||||
@@ -2213,7 +2213,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
} elseif ($resource->getMorphClass() === \App\Models\Application::class) {
|
} elseif ($resource->getMorphClass() === \App\Models\Application::class) {
|
||||||
try {
|
try {
|
||||||
$yaml = Yaml::parse($resource->docker_compose_raw);
|
$yaml = Yaml::parse($resource->docker_compose_raw);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$server = $resource->destination->server;
|
$server = $resource->destination->server;
|
||||||
@@ -2959,7 +2959,7 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$yaml = Yaml::parse($compose);
|
$yaml = Yaml::parse($compose);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception) {
|
||||||
return collect([]);
|
return collect([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4010,7 +4010,7 @@ function loadConfigFromGit(string $repository, string $branch, string $base_dire
|
|||||||
]);
|
]);
|
||||||
try {
|
try {
|
||||||
return instant_remote_process($commands, $server);
|
return instant_remote_process($commands, $server);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception) {
|
||||||
// continue
|
// continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user