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>
|
||||
|
||||
{#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"}
|
||||
<DatePicker
|
||||
{error}
|
||||
|
|
|
@ -27,21 +27,19 @@
|
|||
notifications.success("Row saved successfully")
|
||||
dispatch("updaterows")
|
||||
} catch (error) {
|
||||
if (error.handled) {
|
||||
const response = error.json
|
||||
if (response?.errors) {
|
||||
errors = response.errors
|
||||
} else if (response?.validationErrors) {
|
||||
const mappedErrors = {}
|
||||
for (let field in response.validationErrors) {
|
||||
mappedErrors[
|
||||
field
|
||||
] = `${field} ${response.validationErrors[field][0]}`
|
||||
}
|
||||
errors = mappedErrors
|
||||
const response = error.json
|
||||
if (error.handled && response?.errors) {
|
||||
errors = response.errors
|
||||
} else if (error.handled && response?.validationErrors) {
|
||||
const mappedErrors = {}
|
||||
for (let field in response.validationErrors) {
|
||||
mappedErrors[
|
||||
field
|
||||
] = `${field} ${response.validationErrors[field][0]}`
|
||||
}
|
||||
errors = mappedErrors
|
||||
} else {
|
||||
notifications.error("Failed to save row")
|
||||
notifications.error(`Failed to save row - ${error.message}`)
|
||||
}
|
||||
// Prevent modal closing if there were errors
|
||||
return false
|
||||
|
|
Loading…
Reference in New Issue