Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
lilkidsuave authored Feb 13, 2024
1 parent 2ac6efc commit cb0f4f1
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@ const configFile = require('./config.json')
const servapps = fs.readdirSync('./servapps').filter(file => fs.lstatSync(`./servapps/${file}`).isDirectory())

let servappsJSON = []
let iteration = 1;
for (const file of servapps) {
try {
try {
const servapp = require(`./servapps/${file}/description.json`);
}
catch (error) {
if (error.message.includes('Cannot find module')) {
console.error(`Description.json not found for ${file}. Setting a Placeholder.`);
const servapp = require(`./servapps/Placeholders/description.json`);
iteration = iteration++;
console.error(`Description.json not found for ${file}. Skipping.`);
continue;
} else {
console.error(`Error loading description.json for ${file}:`, error.message);
console.error(`Error loading description.json for ${file}: Skipping`, error.message);
continue;
}
}
servapp.id = file;
Expand All @@ -43,9 +42,7 @@ for (const file of servapps) {
}
servappsJSON.push(servapp)
} catch (error) {
if (error.message.includes('Cannot find module')) {
console.error(`Description.json not found for ${file}. Skipping.`);
} else if (error.message.includes('is not defined')) {
if (error.message.includes('is not defined')) {
console.error(`Error: servapp is not defined for ${file}. Skipping.`);
continue; // Skip to the next iteration
} else {
Expand Down

0 comments on commit cb0f4f1

Please sign in to comment.