From 598c7ea89465463c5f9784314410a9d75362d74f Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Fri, 5 Mar 2021 20:17:14 +0000 Subject: [PATCH] Handle ENOENT exceptions with a graceful message --- dist/index.js | 6 ++++++ index.js | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/dist/index.js b/dist/index.js index ac64344..6b1ea20 100644 --- a/dist/index.js +++ b/dist/index.js @@ -204,6 +204,12 @@ try { }); } catch (error) { + + if (error.code == 'ENOENT') { + console.log(`The '${error.path}' executable could not be found. Please make sure it is on your PATH and/or the necessary packages are installed.`); + console.log(`PATH is set to: ${process.env.PATH}`); + } + core.setFailed(error.message); } diff --git a/index.js b/index.js index cf7b562..199438a 100644 --- a/index.js +++ b/index.js @@ -87,5 +87,11 @@ try { }); } catch (error) { + + if (error.code == 'ENOENT') { + console.log(`The '${error.path}' executable could not be found. Please make sure it is on your PATH and/or the necessary packages are installed.`); + console.log(`PATH is set to: ${process.env.PATH}`); + } + core.setFailed(error.message); }