@@ -54,33 +54,38 @@ class PythonPluginEngine(override val bootstrapPlugin: ScriptEngineMain, overrid
5454 }
5555
5656 override fun loadMainScript (path : String ) {
57- val mainScriptFile = File (path)
58- if (! mainScriptFile.parentFile.exists()) {
59- mainScriptFile.parentFile.mkdirs()
60- }
57+ try {
58+ val mainScriptFile = File (path)
59+ if (! mainScriptFile.parentFile.exists()) {
60+ mainScriptFile.parentFile.mkdirs()
61+ }
6162
62- if (mainScriptFile.exists()) {
63- val mainReturn = eval(
64- Source .newBuilder(languageName, mainScriptFile)
65- .name(mainScriptFile.name)
66- .interactive(false )
67- .build()
68- )
63+ if (mainScriptFile.exists()) {
64+ val mainReturn = eval(
65+ Source .newBuilder(languageName, mainScriptFile)
66+ .name(mainScriptFile.name)
67+ .interactive(false )
68+ .build()
69+ )
6970
70- // Load all plugin types returned as an array
71- if (mainReturn.hasArrayElements()) {
72- for (i in 0 until mainReturn.arraySize) {
73- this .loadPlugin(mainReturn.getArrayElement(i))
74- }
71+ // Load all plugin types returned as an array
72+ if (mainReturn.hasArrayElements()) {
73+ for (i in 0 until mainReturn.arraySize) {
74+ this .loadPlugin(mainReturn.getArrayElement(i))
75+ }
7576
76- // Enable all plugins if not already enabled
77- if (! enabledAllPlugins) {
78- enableAllPlugins()
77+ // Enable all plugins if not already enabled
78+ if (! enabledAllPlugins) {
79+ enableAllPlugins()
80+ }
7981 }
8082 }
83+ else {
84+ throw ScriptNotFoundException (mainScriptFile)
85+ }
8186 }
82- else {
83- throw ScriptNotFoundException (mainScriptFile )
87+ catch (ex : Exception ) {
88+ startupErrors.add(ex )
8489 }
8590 }
8691
0 commit comments