Ignore errors in getContentOfType

This commit is contained in:
Cohee 2024-09-20 08:31:25 +00:00
parent 5001187b3c
commit d7a37298ab
1 changed files with 16 additions and 12 deletions

View File

@ -232,18 +232,22 @@ function getContentOfType(type, format) {
if (!item.folder) { if (!item.folder) {
continue; continue;
} }
const filePath = path.join(item.folder, item.filename); try {
const fileContent = fs.readFileSync(filePath); const filePath = path.join(item.folder, item.filename);
switch (format) { const fileContent = fs.readFileSync(filePath);
case 'json': switch (format) {
files.push(JSON.parse(fileContent.toString())); case 'json':
break; files.push(JSON.parse(fileContent.toString()));
case 'string': break;
files.push(fileContent.toString()); case 'string':
break; files.push(fileContent.toString());
case 'raw': break;
files.push(fileContent); case 'raw':
break; files.push(fileContent);
break;
}
} catch {
// Ignore errors
} }
} }
return files; return files;