Skip to content

Commit

Permalink
error handling, removing sj tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
colbyfayock committed Oct 26, 2024
1 parent ecf0b08 commit e996c37
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/media-library-cleanup.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ const CLOUD_CONFIGS = [
api_key: process.env.NUXT_CLOUDINARY_CLOUDINARY_API_KEY,
api_secret: process.env.NUXT_CLOUDINARY_CLOUDINARY_API_SECRET
},
{
cloud_name: process.env.SPACEJELLY_TUTORIALS_CLOUDINARY_CLOUD_NAME,
api_key: process.env.SPACEJELLY_TUTORIALS_CLOUDINARY_API_KEY,
api_secret: process.env.SPACEJELLY_TUTORIALS_CLOUDINARY_API_SECRET
},
{
cloud_name: process.env.SVELTE_CLOUDINARY_CLOUDINARY_CLOUD_NAME,
api_key: process.env.SVELTE_CLOUDINARY_CLOUDINARY_API_KEY,
Expand All @@ -47,7 +42,10 @@ const CLOUD_CONFIGS = [
cloudinary.config(config);

const moderations = await getAllModerations();
await deleteModerations(moderations);

if ( Array.isArray(moderations) ) {
await deleteModerations(moderations);
}

if ( Array.isArray(config.directoriesToClear) ) {
await clearDirectoriesByPrefixes(config.directoriesToClear);
Expand All @@ -74,7 +72,7 @@ async function getAllModerations() {

return moderations.flat();
} catch(e) {
console.log(`Failed to get all moderations: ${e.message}`);
console.log(`Failed to get all moderations: ${e.message || e.error?.message}`);
}
}

Expand Down

0 comments on commit e996c37

Please sign in to comment.