From b674a0ed884cd0bedbce26abc594d79573a9bc14 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 24 Aug 2023 21:09:58 +0200 Subject: [PATCH] throw errors in jobs --- app/Actions/Server/UpdateCoolify.php | 1 + .../Project/New/GithubPrivateRepositoryDeployKey.php | 2 +- app/Jobs/ApplicationContainerStatusJob.php | 5 +++-- app/Jobs/ApplicationDeploymentJob.php | 1 + app/Jobs/CheckResaleLicenseJob.php | 1 + app/Jobs/CleanupInstanceStuffsJob.php | 1 + app/Jobs/DatabaseBackupJob.php | 2 +- app/Jobs/DatabaseContainerStatusJob.php | 1 + app/Jobs/DockerCleanupJob.php | 1 + app/Jobs/ProxyCheckJob.php | 2 +- app/Jobs/ProxyContainerStatusJob.php | 2 ++ app/Jobs/ProxyStartJob.php | 1 + app/Jobs/ResourceStatusJob.php | 2 ++ app/Jobs/SubscriptionInvoiceFailedJob.php | 2 ++ 14 files changed, 19 insertions(+), 5 deletions(-) diff --git a/app/Actions/Server/UpdateCoolify.php b/app/Actions/Server/UpdateCoolify.php index 35b51f762..fa0718d17 100644 --- a/app/Actions/Server/UpdateCoolify.php +++ b/app/Actions/Server/UpdateCoolify.php @@ -44,6 +44,7 @@ class UpdateCoolify ray('InstanceAutoUpdateJob failed'); ray($th->getMessage()); send_internal_notification('InstanceAutoUpdateJob failed: ' . $th->getMessage()); + throw $th; } } diff --git a/app/Http/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php b/app/Http/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php index a2ccd5298..82d898149 100644 --- a/app/Http/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php +++ b/app/Http/Livewire/Project/New/GithubPrivateRepositoryDeployKey.php @@ -43,7 +43,7 @@ class GithubPrivateRepositoryDeployKey extends Component 'publish_directory' => 'Publish directory', ]; private object $repository_url_parsed; - private GithubApp|GitlabApp $git_source; + private GithubApp|GitlabApp|null $git_source = null; private string $git_host; private string $git_repository; private string $git_branch; diff --git a/app/Jobs/ApplicationContainerStatusJob.php b/app/Jobs/ApplicationContainerStatusJob.php index 6930fc69a..2f529e121 100644 --- a/app/Jobs/ApplicationContainerStatusJob.php +++ b/app/Jobs/ApplicationContainerStatusJob.php @@ -46,8 +46,9 @@ class ApplicationContainerStatusJob implements ShouldQueue, ShouldBeUnique $this->application->status = $status; $this->application->save(); } - } catch (\Exception $e) { - ray($e->getMessage()); + } catch (\Exception $th) { + ray($th->getMessage()); + throw $th; } } } diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index 5a76b26ba..5f24d4ab8 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -136,6 +136,7 @@ class ApplicationDeploymentJob implements ShouldQueue } catch (Exception $e) { ray($e); $this->fail($e); + throw $e; } finally { if (isset($this->docker_compose_base64)) { $readme = generate_readme_file($this->application->name, $this->application_deployment_queue->updated_at); diff --git a/app/Jobs/CheckResaleLicenseJob.php b/app/Jobs/CheckResaleLicenseJob.php index 96211451b..30f9ff198 100644 --- a/app/Jobs/CheckResaleLicenseJob.php +++ b/app/Jobs/CheckResaleLicenseJob.php @@ -24,6 +24,7 @@ class CheckResaleLicenseJob implements ShouldQueue } catch (\Throwable $th) { send_internal_notification('CheckResaleLicenseJob failed with: ' . $th->getMessage()); ray($th); + throw $th; } } } diff --git a/app/Jobs/CleanupInstanceStuffsJob.php b/app/Jobs/CleanupInstanceStuffsJob.php index e67a562bd..b133279ea 100644 --- a/app/Jobs/CleanupInstanceStuffsJob.php +++ b/app/Jobs/CleanupInstanceStuffsJob.php @@ -31,6 +31,7 @@ class CleanupInstanceStuffsJob implements ShouldQueue, ShouldBeUnique } catch (\Exception $e) { send_internal_notification('CleanupInstanceStuffsJob failed with error: ' . $e->getMessage()); ray($e->getMessage()); + throw $e; } } diff --git a/app/Jobs/DatabaseBackupJob.php b/app/Jobs/DatabaseBackupJob.php index 44e5601ba..6e1ee2f0c 100644 --- a/app/Jobs/DatabaseBackupJob.php +++ b/app/Jobs/DatabaseBackupJob.php @@ -97,7 +97,7 @@ class DatabaseBackupJob implements ShouldQueue } catch (\Throwable $th) { ray($th->getMessage()); send_internal_notification('DatabaseBackupJob failed with: ' . $th->getMessage()); - //throw $th; + throw $th; } } diff --git a/app/Jobs/DatabaseContainerStatusJob.php b/app/Jobs/DatabaseContainerStatusJob.php index c331d3d4f..80a641db2 100644 --- a/app/Jobs/DatabaseContainerStatusJob.php +++ b/app/Jobs/DatabaseContainerStatusJob.php @@ -50,6 +50,7 @@ class DatabaseContainerStatusJob implements ShouldQueue, ShouldBeUnique } catch (\Exception $e) { send_internal_notification('DatabaseContainerStatusJob failed with: ' . $e->getMessage()); ray($e->getMessage()); + throw $e; } } } diff --git a/app/Jobs/DockerCleanupJob.php b/app/Jobs/DockerCleanupJob.php index 821688754..6b8ccda79 100644 --- a/app/Jobs/DockerCleanupJob.php +++ b/app/Jobs/DockerCleanupJob.php @@ -51,6 +51,7 @@ class DockerCleanupJob implements ShouldQueue } catch (\Exception $e) { send_internal_notification('DockerCleanupJob failed with: ' . $e->getMessage()); ray($e->getMessage()); + throw $e; } } diff --git a/app/Jobs/ProxyCheckJob.php b/app/Jobs/ProxyCheckJob.php index 6316c204a..ea8fe967d 100755 --- a/app/Jobs/ProxyCheckJob.php +++ b/app/Jobs/ProxyCheckJob.php @@ -34,7 +34,7 @@ class ProxyCheckJob implements ShouldQueue } catch (\Throwable $th) { ray($th->getMessage()); send_internal_notification('ProxyCheckJob failed with: ' . $th->getMessage()); - //throw $th; + throw $th; } } } diff --git a/app/Jobs/ProxyContainerStatusJob.php b/app/Jobs/ProxyContainerStatusJob.php index ddd6e5b8d..ed63ed8fe 100644 --- a/app/Jobs/ProxyContainerStatusJob.php +++ b/app/Jobs/ProxyContainerStatusJob.php @@ -58,6 +58,8 @@ class ProxyContainerStatusJob implements ShouldQueue, ShouldBeUnique $this->server->save(); } send_internal_notification('ProxyContainerStatusJob failed with: ' . $e->getMessage()); + ray($e->getMessage()); + throw $e; } } } diff --git a/app/Jobs/ProxyStartJob.php b/app/Jobs/ProxyStartJob.php index 7f1df6377..4e2331a68 100755 --- a/app/Jobs/ProxyStartJob.php +++ b/app/Jobs/ProxyStartJob.php @@ -31,6 +31,7 @@ class ProxyStartJob implements ShouldQueue } catch (\Throwable $th) { send_internal_notification('ProxyStartJob failed with: ' . $th->getMessage()); ray($th->getMessage()); + throw $th; } } } diff --git a/app/Jobs/ResourceStatusJob.php b/app/Jobs/ResourceStatusJob.php index 4ff4063d4..efd6d1445 100644 --- a/app/Jobs/ResourceStatusJob.php +++ b/app/Jobs/ResourceStatusJob.php @@ -39,6 +39,8 @@ class ResourceStatusJob implements ShouldQueue, ShouldBeUnique } } catch (\Exception $th) { send_internal_notification('ResourceStatusJob failed with: ' . $th->getMessage()); + ray($th); + throw $th; } } } diff --git a/app/Jobs/SubscriptionInvoiceFailedJob.php b/app/Jobs/SubscriptionInvoiceFailedJob.php index 3d0e1bb8d..d6750f953 100755 --- a/app/Jobs/SubscriptionInvoiceFailedJob.php +++ b/app/Jobs/SubscriptionInvoiceFailedJob.php @@ -36,6 +36,8 @@ class SubscriptionInvoiceFailedJob implements ShouldQueue }); } catch (\Throwable $th) { send_internal_notification('SubscriptionInvoiceFailedJob failed with: ' . $th->getMessage()); + ray($th->getMessage()); + throw $th; } } }