Skip to content

Commit 73c6126

Browse files
Improve Graphviz support detection
Previous implementation was assuming that an error was always caused by the Graphviz binary not available in the path. However an error can also be thrown when Graphviz is missing an external dependencies for example. As far as I know ENOENT stands for a no entry error which indicates that something wasn't found. In this case it should be safe to assume that Graphviz isn't available in the path. See: https://stackoverflow.com/q/66602685/1244884
1 parent 03b7ba0 commit 73c6126

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/graph.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ async function checkGraphvizInstalled(config) {
2828
try {
2929
await exec(cmd, ['-V']);
3030
} catch (err) {
31-
throw new Error(`Graphviz could not be found. Ensure that "gvpr" is in your $PATH. ${err}`);
31+
if (err.code === 'ENOENT') {
32+
throw new Error(`Graphviz could not be found. Ensure that "gvpr" is in your $PATH. ${err}`);
33+
} else {
34+
throw new Error(`Unexpected error when calling Graphviz "${cmd}". ${err}`);
35+
}
3236
}
3337
}
3438

0 commit comments

Comments
 (0)