Skip to content

Commit

Permalink
#1324: handle template more gracefully for asset
Browse files Browse the repository at this point in the history
  • Loading branch information
JoernBerkefeld committed May 16, 2024
1 parent 22f06c8 commit ee20625
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
3 changes: 2 additions & 1 deletion lib/Builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ saved
);
})
);
if (result && type === result[0].type) {
if (result && type === result[0]?.type) {
// result elements can be undefined for each key that we did not find
this.metadata[type] = result.filter(Boolean).map((element) => element.metadata);
}
} catch (ex) {
Expand Down
24 changes: 9 additions & 15 deletions lib/metadataTypes/MetadataType.js
Original file line number Diff line number Diff line change
Expand Up @@ -1958,23 +1958,17 @@ class MetadataType {
ex
);
} catch {
throw new Error(
`${this.definition.type}:: Could not find ./${File.normalizePath([
templateDir,
...typeDirArr,
fileName + '.json',
])}.`
// only happening for types that use readSecondaryFolder (e.g. asset)
// if we still have no metadataStr then we have to skip this metadata for all types and hence handle it outside of this catch
}
if (!metadataStr) {
Util.logger.warn(
Util.getGrayMsg(
`- skipped ${this.definition.type} ${templateName}: template not found`
)
);
return;
}
// return;
}
if (!metadataStr) {
Util.logger.info(
Util.getGrayMsg(
`- skipped ${this.definition.type} ${templateName}: template not found`
)
);
return;
}

let metadata;
Expand Down

0 comments on commit ee20625

Please sign in to comment.