Raise exception when node is not on PATH

This commit is contained in:
mvdbeek
2019-03-20 10:02:18 +01:00
parent f427a74dd9
commit 98738d80aa
2 changed files with 6 additions and 2 deletions
+4 -2
View File
@@ -753,8 +753,10 @@ class Tool(Dictifiable):
mod = __import__(module, globals(), locals(), [cls])
self.tool_action = getattr(mod, cls)()
if getattr(self.tool_action, "requires_js_runtime", False):
if expressions.find_engine(self.app.config) is None:
message = REQUIRES_JS_RUNTIME_MESSAGE % self.tool_id
try:
expressions.find_engine(self.app.config)
except Exception:
message = REQUIRES_JS_RUNTIME_MESSAGE % self.tool_id or self.tool_uuid
raise Exception(message)
# Tests
self.__parse_tests(tool_source)
+2
View File
@@ -5,4 +5,6 @@ def find_engine(config):
nodejs_path = getattr(config, "nodejs_path", None)
if nodejs_path is None:
nodejs_path = which("nodejs") or which("node") or None
if nodejs_path is None:
raise Exception("nodejs or node not found on PATH")
return nodejs_path