First version of giving feedback to contriubtors on invalid values
This commit is contained in:
parent
e07b770e8c
commit
5221e91dcd
16 changed files with 586 additions and 436 deletions
|
@ -56,8 +56,8 @@ export default class FilterConfig {
|
|||
|
||||
const fields: { name: string, type: string }[] = ((option.fields) ?? []).map((f, i) => {
|
||||
const type = f.type ?? "string"
|
||||
if (!ValidatedTextField.AllTypes.has(type)) {
|
||||
throw `Invalid filter: ${type} is not a valid validated textfield type (at ${ctx}.fields[${i}])\n\tTry one of ${Array.from(ValidatedTextField.AllTypes.keys()).join(",")}`
|
||||
if (!ValidatedTextField.ForType(type) === undefined) {
|
||||
throw `Invalid filter: ${type} is not a valid validated textfield type (at ${ctx}.fields[${i}])\n\tTry one of ${Array.from(ValidatedTextField.AvailableTypes()).join(",")}`
|
||||
}
|
||||
if (f.name === undefined || f.name === "" || f.name.match(/[a-z0-9_-]+/) == null) {
|
||||
throw `Invalid filter: a variable name should match [a-z0-9_-]+ at ${ctx}.fields[${i}]`
|
||||
|
|
|
@ -133,7 +133,7 @@ export default class TagRenderingConfig {
|
|||
}
|
||||
|
||||
|
||||
if (!ValidatedTextField.AllTypes.has(this.freeform.type)) {
|
||||
if (!ValidatedTextField.ForType(this.freeform.key) === undefined) {
|
||||
const knownKeys = ValidatedTextField.AvailableTypes().join(", ");
|
||||
throw `Freeform.key ${this.freeform.key} is an invalid type. Known keys are ${knownKeys}`
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue