Skip to content

Commit

Permalink
Handle ENOENT exceptions with a graceful message
Browse files Browse the repository at this point in the history
  • Loading branch information
mpdude committed Mar 5, 2021
1 parent 65d1ea3 commit 598c7ea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 598c7ea

Please sign in to comment.