From 488104865b7730b27a79488d28f88ff13e9254eb Mon Sep 17 00:00:00 2001 From: Andrey Borysenko Date: Tue, 21 May 2024 14:13:05 +0300 Subject: [PATCH] fix: catch error if test ExApp not registered (#293) Resolves: #292 Signed-off-by: Andrey Borysenko Co-authored-by: Alexander Piskun <13381981+bigcat88@users.noreply.github.com> --- lib/Controller/DaemonConfigController.php | 6 ++++-- src/components/DaemonConfig/DaemonTestDeploy.vue | 12 ++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/Controller/DaemonConfigController.php b/lib/Controller/DaemonConfigController.php index 6d4f1e8b..7b933ab5 100644 --- a/lib/Controller/DaemonConfigController.php +++ b/lib/Controller/DaemonConfigController.php @@ -142,10 +142,12 @@ public function startTestDeploy(string $name): Response { } $exApp = $this->exAppService->getExApp(Application::TEST_DEPLOY_APPID); - $status = $exApp->getStatus(); + if ($exApp === null) { + return new JSONResponse(['error' => $this->l10n->t('ExApp failed to register, check the NC logs')], Http::STATUS_INTERNAL_SERVER_ERROR); + } return new JSONResponse([ - 'status' => $status, + 'status' => $exApp->getStatus(), ]); } diff --git a/src/components/DaemonConfig/DaemonTestDeploy.vue b/src/components/DaemonConfig/DaemonTestDeploy.vue index d6f8bc0f..8fdf98ba 100644 --- a/src/components/DaemonConfig/DaemonTestDeploy.vue +++ b/src/components/DaemonConfig/DaemonTestDeploy.vue @@ -268,7 +268,10 @@ export default { this.statusChecks.register.passed = true this.statusChecks.register.loading = false } - }).catch(() => { + }).catch((err) => { + if (err.response.data.error) { + showError(err.response.data.error) + } this.stopDeployTest() }).finally(() => { this.startingTest = false @@ -279,13 +282,6 @@ export default { .then(res => { this.startDeployTestPolling() return res - }).catch(err => { - console.debug(err) - if (err.data.error) { - showError(err.data.error) - } - this.clearTestRunning() - return err }).finally(() => { this.getAllDaemons() })