add try catch to all environment variable loading
This commit is contained in:
parent
ee94435c06
commit
71352f1ddc
8 changed files with 34 additions and 19 deletions
|
@ -218,7 +218,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await environment.loadVariables()
|
try {
|
||||||
|
await environment.loadVariables()
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -96,10 +96,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await environment.loadVariables()
|
try {
|
||||||
|
await environment.loadVariables()
|
||||||
if ($auth.user) {
|
if ($auth.user) {
|
||||||
await licensing.init()
|
await licensing.init()
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -45,10 +45,13 @@
|
||||||
let formFieldkey
|
let formFieldkey
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await environment.loadVariables()
|
try {
|
||||||
|
await environment.loadVariables()
|
||||||
if ($auth.user) {
|
if ($auth.user) {
|
||||||
await licensing.init()
|
await licensing.init()
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentConfig) {
|
if (currentConfig) {
|
||||||
|
|
|
@ -105,7 +105,7 @@
|
||||||
>
|
>
|
||||||
{#each fields as field, idx}
|
{#each fields as field, idx}
|
||||||
<Input
|
<Input
|
||||||
placeholder={"hello"}
|
placeholder={keyPlaceholder}
|
||||||
readonly={readOnly}
|
readonly={readOnly}
|
||||||
bind:value={field.name}
|
bind:value={field.name}
|
||||||
on:blur={changed}
|
on:blur={changed}
|
||||||
|
|
|
@ -367,7 +367,7 @@
|
||||||
// load the environment variables
|
// load the environment variables
|
||||||
await environment.loadVariables()
|
await environment.loadVariables()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifications.error("Error getting environment variables")
|
notifications.error(`Error getting environment variables - ${error}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
datasource = $datasources.list.find(ds => ds._id === query?.datasourceId)
|
datasource = $datasources.list.find(ds => ds._id === query?.datasourceId)
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
})
|
})
|
||||||
notifications.success("Environment variable saved")
|
notifications.success("Environment variable saved")
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
notifications.error("Error saving environment variable")
|
notifications.error(`Error saving environment variable - ${err.message}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
let editVariableModal
|
let editVariableModal
|
||||||
let deleteDialog
|
let deleteDialog
|
||||||
|
|
||||||
const save = data => {
|
const save = async data => {
|
||||||
environment.updateVariable(data)
|
await environment.updateVariable(data)
|
||||||
editVariableModal.hide()
|
editVariableModal.hide()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -23,8 +23,8 @@
|
||||||
|
|
||||||
<ConfirmDialog
|
<ConfirmDialog
|
||||||
bind:this={deleteDialog}
|
bind:this={deleteDialog}
|
||||||
onOk={() => {
|
onOk={async () => {
|
||||||
environment.deleteVariable(row.name)
|
await environment.deleteVariable(row.name)
|
||||||
}}
|
}}
|
||||||
okText="Delete Environment Variable"
|
okText="Delete Environment Variable"
|
||||||
title="Confirm Deletion"
|
title="Confirm Deletion"
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
Tags,
|
Tags,
|
||||||
Tag,
|
Tag,
|
||||||
InlineAlert,
|
InlineAlert,
|
||||||
|
notifications,
|
||||||
} from "@budibase/bbui"
|
} from "@budibase/bbui"
|
||||||
import { environment, licensing, auth, admin } from "stores/portal"
|
import { environment, licensing, auth, admin } from "stores/portal"
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
|
@ -44,9 +45,13 @@
|
||||||
return schema
|
return schema
|
||||||
}
|
}
|
||||||
|
|
||||||
const save = data => {
|
const save = async data => {
|
||||||
environment.createVariable(data)
|
try {
|
||||||
modal.hide()
|
await environment.createVariable(data)
|
||||||
|
modal.hide()
|
||||||
|
} catch (err) {
|
||||||
|
notifications.error(`Error saving variable: ${err.message}`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue