Added error check

This commit is contained in:
2021-03-31 12:05:32 +11:00
parent 14649a3b53
commit 15b1fcdc7c
2 changed files with 24 additions and 18 deletions

View File

@@ -47,6 +47,11 @@ const readBlock = (tokens, current, superType, typeGraph, options) => {
console.log(`Trying to process field ${fieldName}`);
}
//if the field is not present in the type
if (!typeGraph[superType][fieldName]) {
throw `Unexpected field name ${fieldName} in type ${superType}`;
}
//if the field is non-scalar, read the sub-block
if (!typeGraph[typeGraph[superType][fieldName].typeName].scalar) {
//recurse