From e996c37fb6cb89b173eca9b1b2379b8b95932dc2 Mon Sep 17 00:00:00 2001 From: Colby Fayock Date: Fri, 25 Oct 2024 21:02:46 -0400 Subject: [PATCH] error handling, removing sj tutorials --- src/media-library-cleanup.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/media-library-cleanup.js b/src/media-library-cleanup.js index 0eede26..9fedf5f 100644 --- a/src/media-library-cleanup.js +++ b/src/media-library-cleanup.js @@ -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, @@ -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); @@ -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}`); } }