From 55aad42e4674b58b2b2fb7d8e7552402d922b4e7 Mon Sep 17 00:00:00 2001
From: aparnajyothi-y <147696841+aparnajyothi-y@users.noreply.github.com>
Date: Tue, 5 Nov 2024 06:57:40 +0530
Subject: [PATCH] Update error message for no dependencies to cache (#968)

---
 dist/cache-save/index.js | 2 +-
 src/cache-save.ts        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dist/cache-save/index.js b/dist/cache-save/index.js
index aa4501f..2b22f4a 100644
--- a/dist/cache-save/index.js
+++ b/dist/cache-save/index.js
@@ -81165,7 +81165,7 @@ function saveCache(packageManager) {
         const cachePaths = JSON.parse(cachePathState);
         core.debug(`paths for caching are ${cachePaths.join(', ')}`);
         if (!isCacheDirectoryExists(cachePaths)) {
-            throw new Error(`Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePaths.join(', ')}`);
+            throw new Error(`Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePaths.join(', ')}. This likely indicates that there are no dependencies to cache. Consider removing the cache step if it is not needed.`);
         }
         const primaryKey = core.getState(cache_distributor_1.State.STATE_CACHE_PRIMARY_KEY);
         const matchedKey = core.getState(cache_distributor_1.State.CACHE_MATCHED_KEY);
diff --git a/src/cache-save.ts b/src/cache-save.ts
index fbb481c..4aec04e 100644
--- a/src/cache-save.ts
+++ b/src/cache-save.ts
@@ -41,7 +41,7 @@ async function saveCache(packageManager: string) {
     throw new Error(
       `Cache folder path is retrieved for ${packageManager} but doesn't exist on disk: ${cachePaths.join(
         ', '
-      )}`
+      )}. This likely indicates that there are no dependencies to cache. Consider removing the cache step if it is not needed.`
     );
   }