From b71295e4de658fb134b67eaa0b630704f858ce7e Mon Sep 17 00:00:00 2001 From: Alex Grozav Date: Tue, 6 Dec 2022 14:35:57 +0200 Subject: [PATCH] fix: Handle error when workflow does not exist or is inaccessible (#4831) --- packages/editor-ui/src/views/NodeView.vue | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/editor-ui/src/views/NodeView.vue b/packages/editor-ui/src/views/NodeView.vue index 9d9e00b306..0bff6c1134 100644 --- a/packages/editor-ui/src/views/NodeView.vue +++ b/packages/editor-ui/src/views/NodeView.vue @@ -2187,7 +2187,7 @@ export default mixins( const executionId = this.$route.params.id; await this.openExecution(executionId); } else { - const result = this.uiStore.stateIsDirty;; + const result = this.uiStore.stateIsDirty; if (result) { const confirmModal = await this.confirmModal( this.$locale.baseText('generic.unsavedWork.confirmMessage.message'), @@ -2210,17 +2210,18 @@ export default mixins( workflowId = this.$route.params.name; } if (workflowId !== null) { - const workflow = await this.restApi().getWorkflow(workflowId); - if (!workflow) { + let workflow; + try { + workflow = await this.restApi().getWorkflow(workflowId); + } catch (error) { + this.$showError(error, this.$locale.baseText('openWorkflow.workflowNotFoundError')); + this.$router.push({ name: VIEWS.NEW_WORKFLOW, }); - this.$showMessage({ - title: 'Error', - message: this.$locale.baseText('openWorkflow.workflowNotFoundError'), - type: 'error', - }); - } else { + } + + if (workflow) { this.$titleSet(workflow.name, 'IDLE'); // Open existing workflow await this.openWorkflow(workflowId);