Wrapping throws in new errors.

This commit is contained in:
mike12345567 2021-02-25 12:10:18 +00:00
parent a311002632
commit 429811ec8b
1 changed files with 4 additions and 2 deletions

View File

@ -125,7 +125,9 @@ class LinkController {
}
const unique = schema.tableId + schema.fieldName
if (usedAlready.indexOf(unique) !== -1) {
throw "Cannot re-use the linked column name for a linked table."
throw new Error(
"Cannot re-use the linked column name for a linked table."
)
}
usedAlready.push(unique)
}
@ -292,7 +294,7 @@ class LinkController {
// check the linked table to make sure we aren't overwriting an existing column
const existingSchema = linkedTable.schema[field.fieldName]
if (existingSchema != null && !isEqual(existingSchema, linkConfig)) {
throw "Cannot overwrite existing column."
throw new Error("Cannot overwrite existing column.")
}
// create the link field in the other table
linkedTable.schema[field.fieldName] = linkConfig