Skip to content

Commit

Permalink
feat: improve package.json loading error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j committed Oct 13, 2019
1 parent 245362b commit e5fe68d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Adio.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ class Adio {
testPackage(dir) {
let packageJson;
try {
packageJson = JSON.parse(fs.readFileSync(path.join(dir, "package.json"), "utf8"));
packageJson = fs.readFileSync(path.join(dir, "package.json"), "utf8");
} catch (e) {
throw Error("Could not open package.json located at " + dir);
}

try {
packageJson = JSON.parse(packageJson);
} catch (e) {
throw Error("Could not parse package.json located at " + dir);
}
Expand Down

0 comments on commit e5fe68d

Please sign in to comment.