Skip to content

Commit

Permalink
Print error message for errors without error codes and cleanup error …
Browse files Browse the repository at this point in the history
…stings
  • Loading branch information
razzeee committed Aug 28, 2018
1 parent f398975 commit 46008dd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,18 @@ function compilerErrorToString(err, pathToElm) {
if ((typeof err === "object") && (typeof err.code === "string")) {
switch (err.code) {
case "ENOENT":
return ("Could not find Elm compiler \"" + pathToElm + "\". Is it installed?")
return "Could not find Elm compiler \"" + pathToElm + "\". Is it installed?";

case "EACCES":
return ("Elm compiler \"" + pathToElm + "\" did not have permission to run. Do you need to give it executable permissions?");
return "Elm compiler \"" + pathToElm + "\" did not have permission to run. Do you need to give it executable permissions?";

default:
return ("Error attempting to run Elm compiler \"" + pathToElm + "\":\n" + err);
return "Error attempting to run Elm compiler \"" + pathToElm + "\":\n" + err;
}
} else if ((typeof err === "object") && (typeof err.message === "string")) {
return JSON.stringify(err.message);
} else {
return ("Exception thrown when attempting to run Elm compiler " + JSON.stringify(pathToElm) + ":\n");
return "Exception thrown when attempting to run Elm compiler " + JSON.stringify(pathToElm);
}
}

Expand Down

0 comments on commit 46008dd

Please sign in to comment.