Skip to content

Commit dc56c7c

Browse files
committed
Warn once for unmapped instance folders
Replace a hard error for unimplemented instance folder names with a warning that is emitted only once per unique folder name. Introduces a containers.Map (hasWarned) to track which folder names have already triggered the warning and uses the identifier 'OPENMINDS:InstanceLibrary:createInstanceTable:MissingTypeMapping'. This avoids aborting execution for unmapped folders while preventing repeated duplicate warnings.
1 parent 048b729 commit dc56c7c

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

code/internal/+openminds/+internal/@InstanceLibrary/InstanceLibrary.m

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ function postSetLibraryVersion(obj)
148148

149149
numInstances = numel(filePaths);
150150
[types, modules, subGroups] = deal(repmat("", numInstances, 1));
151+
152+
hasWarned = containers.Map();
153+
151154
for i = 1:numInstances
152155

153156
thisFolderSplit = split(folderNames(i), filesep);
@@ -179,7 +182,13 @@ function postSetLibraryVersion(obj)
179182
modules(i) = "core";
180183
subGroups(i) = missing;
181184
else
182-
error('The instance folder with name "%s" is not implemented. Please report', thisFolderSplit(1))
185+
186+
if ~isKey(hasWarned, thisFolderSplit(1))
187+
warning('OPENMINDS:InstanceLibrary:createInstanceTable:MissingTypeMapping', ...
188+
['The instance folder with name "%s" is not ', ...
189+
'mapped to an openMINDS type. Please report'], thisFolderSplit(1))
190+
hasWarned(thisFolderSplit(1)) = true;
191+
end
183192
end
184193
end
185194

0 commit comments

Comments
 (0)