From 62c0c2cd419e51d477dce9da78a4ca9077a564f3 Mon Sep 17 00:00:00 2001 From: GnsP Date: Wed, 27 Nov 2024 20:30:36 +0530 Subject: [PATCH] invert error condition --- app/cdap/services/global-constants.js | 1 + .../services/create/stores/config-store.js | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/cdap/services/global-constants.js b/app/cdap/services/global-constants.js index d4670a86f6f..5a33b497d48 100644 --- a/app/cdap/services/global-constants.js +++ b/app/cdap/services/global-constants.js @@ -226,6 +226,7 @@ const GLOBALS = { 'ARTIFACT-UPLOAD-ERROR-JSON': 'Error in parsing config json for the artifact.', }, error: { + 'GENERIC-BACKEND-ERROR': 'Something went wrong ! Please try again.', 'SYNTAX-CONFIG-JSON': 'Error parsing widgets JSON for the plugin. Please check the documentation to fix.', 'SEMANTIC-CONFIG-JSON': 'Semantic error in the configuration JSON for the plugin.', diff --git a/app/hydrator/services/create/stores/config-store.js b/app/hydrator/services/create/stores/config-store.js index caf1ccdda59..84f3c0493c5 100644 --- a/app/hydrator/services/create/stores/config-store.js +++ b/app/hydrator/services/create/stores/config-store.js @@ -1368,19 +1368,27 @@ class HydratorPlusPlusConfigStore { this.EventPipe.emit('hideLoadingIcon.immediate'); }; + let displayGenericBackendError = () => { + this.HydratorPlusPlusConsoleActions.addMessage([{ + type: 'error', + content: this.GLOBALS.en.hydrator.studio.error['GENERIC-BACKEND-ERROR'] + }]); + this.EventPipe.emit('hideLoadingIcon.immediate'); + }; + // Checking if Pipeline name already exist - this.myAppsApi.get({ + this.myAppsApi.get({ namespace: this.$state.params.namespace, appId: config.name, }).$promise.then((app) => { displayPipelineNameExistsError(); }).catch((err) => { - if (err.status !== 404) { - displayPipelineNameExistsError(); - } else { + if (err.status === 404) { delete config.change; delete config.parentVersion; publish(config.name); + } else { + displayGenericBackendError(); } }); }