Skip to content

Commit 849ac1f

Browse files
committed
script: more verbose error if script file doesn't exist
1 parent 9e94632 commit 849ac1f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

console/src/main/scala/io/joern/console/BridgeBase.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,10 @@ trait BridgeBase extends InteractiveShell with ScriptExecution with PluginHandli
186186
new PluginManager(InstallConfig().rootPath).rm(config.rmPlugin.get)
187187
} else if (config.scriptFile.isDefined) {
188188
val scriptReturn = runScript(config)
189-
if (scriptReturn.isFailure) System.exit(1)
189+
if (scriptReturn.isFailure) {
190+
println(scriptReturn.failed.get.getMessage)
191+
System.exit(1)
192+
}
190193
} else if (config.server) {
191194
GlobalReporting.enable()
192195
startHttpServer(config)
@@ -246,7 +249,7 @@ trait ScriptExecution { this: BridgeBase =>
246249
def runScript(config: Config): Try[Unit] = {
247250
val scriptFile = config.scriptFile.getOrElse(throw new AssertionError("no script file configured"))
248251
if (!Files.exists(scriptFile)) {
249-
Try(throw new AssertionError(s"given script file $scriptFile does not exist"))
252+
Try(throw new AssertionError(s"given script file `$scriptFile` does not exist"))
250253
} else {
251254
val predefFile = createPredefFile(importCpgCode(config))
252255
val scriptReturn = ScriptRunner.exec(

0 commit comments

Comments
 (0)