From 39a3047a1019ecabd7b6e1ce2f3b80f15d08bb2e Mon Sep 17 00:00:00 2001 From: Arman Date: Wed, 23 Aug 2023 17:21:05 +0200 Subject: [PATCH] fix: rawVariableedito error handling --- .../project-[project]/rawVariableEditor.svelte | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/routes/console/project-[project]/rawVariableEditor.svelte b/src/routes/console/project-[project]/rawVariableEditor.svelte index aef7b8844..97382f807 100644 --- a/src/routes/console/project-[project]/rawVariableEditor.svelte +++ b/src/routes/console/project-[project]/rawVariableEditor.svelte @@ -16,10 +16,10 @@ export let sdkUpdateVariable: (variableId: string, key: string, value: string) => Promise; export let sdkDeleteVariable: (variableId: string) => Promise; + let error = ''; let envCode = variableList.variables .map((variable) => `${variable.key}=${variable.value}`) .join('\n'); - const baseEnvCode = envCode; let jsonCode = JSON.stringify( JSON.parse( `{${variableList.variables @@ -29,6 +29,7 @@ null, 2 ); + const baseEnvCode = envCode; const baseJsonCode = jsonCode; if (jsonCode === '{}') { @@ -78,15 +79,9 @@ }); trackEvent(Submit.VariableEditor); - } catch (error) { - showEditor = false; - - addNotification({ - type: 'error', - message: error.message - }); - - trackError(error, Submit.VariableEditor); + } catch (e) { + error = e.message; + trackError(e, Submit.VariableEditor); } } @@ -120,6 +115,7 @@ headerDivider={false} bind:show={showEditor} onSubmit={handleSubmit} + bind:error size="big">

Edit {isGlobal ? 'global' : 'environment'} variables below or download as a