diff --git a/lib/Builder.js b/lib/Builder.js index e0ceb1814..db3883b62 100644 --- a/lib/Builder.js +++ b/lib/Builder.js @@ -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) { diff --git a/lib/metadataTypes/MetadataType.js b/lib/metadataTypes/MetadataType.js index 1a4bf6516..ea0584364 100644 --- a/lib/metadataTypes/MetadataType.js +++ b/lib/metadataTypes/MetadataType.js @@ -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;