Merge pull request #10227 from Budibase/fix/10155
Fixing #10155 - some options errors were being swallowed and in gener…
This commit is contained in:
commit
3eafda506f
|
@ -42,7 +42,13 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if type === "options" && meta.constraints.inclusion.length !== 0}
|
{#if type === "options" && meta.constraints.inclusion.length !== 0}
|
||||||
<Select {label} bind:value options={meta.constraints.inclusion} sort />
|
<Select
|
||||||
|
{label}
|
||||||
|
bind:value
|
||||||
|
options={meta.constraints.inclusion}
|
||||||
|
sort
|
||||||
|
{error}
|
||||||
|
/>
|
||||||
{:else if type === "datetime"}
|
{:else if type === "datetime"}
|
||||||
<DatePicker
|
<DatePicker
|
||||||
{error}
|
{error}
|
||||||
|
|
|
@ -27,21 +27,19 @@
|
||||||
notifications.success("Row saved successfully")
|
notifications.success("Row saved successfully")
|
||||||
dispatch("updaterows")
|
dispatch("updaterows")
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.handled) {
|
const response = error.json
|
||||||
const response = error.json
|
if (error.handled && response?.errors) {
|
||||||
if (response?.errors) {
|
errors = response.errors
|
||||||
errors = response.errors
|
} else if (error.handled && response?.validationErrors) {
|
||||||
} else if (response?.validationErrors) {
|
const mappedErrors = {}
|
||||||
const mappedErrors = {}
|
for (let field in response.validationErrors) {
|
||||||
for (let field in response.validationErrors) {
|
mappedErrors[
|
||||||
mappedErrors[
|
field
|
||||||
field
|
] = `${field} ${response.validationErrors[field][0]}`
|
||||||
] = `${field} ${response.validationErrors[field][0]}`
|
|
||||||
}
|
|
||||||
errors = mappedErrors
|
|
||||||
}
|
}
|
||||||
|
errors = mappedErrors
|
||||||
} else {
|
} else {
|
||||||
notifications.error("Failed to save row")
|
notifications.error(`Failed to save row - ${error.message}`)
|
||||||
}
|
}
|
||||||
// Prevent modal closing if there were errors
|
// Prevent modal closing if there were errors
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in New Issue