NetLogo / LevelSpace

This is the LevelSpace extension repository. LevelSpace allows you to run NetLogo models |: from inside NetLogo models :|
Other
19 stars 8 forks source link

Creating a model from non-existing .nlogo file breaks NetLogo #138

Closed arthurhjorth closed 5 years ago

arthurhjorth commented 5 years ago

If you run any of the create-*primitives on a .nlogo file that doesn't exist, NetLogo breaks, and you can't even reset it with __reset-extensions. You can't run reporters or do anything other than restart NetLogo. That's pretty disruptive to one's workflow.

This is in NetLogo 6.1.0 with bundled extension, on Mac OS. Haven't tested on other systems. This wasn't always the case, was it? Any thoughts on how easy it would be to fix?

qiemem commented 5 years ago

Confirmed. Here's the stack trace:

java.lang.Exception: Unable to open model with current format: /home/bryan/Development/NetLogo/netlogo-gui/dne.nlogo
 at org.nlogo.api.ModelLoader.readModel(ModelLoader.scala:65)
 at org.nlogo.api.ModelLoader.readModel$(ModelLoader.scala:60)
 at org.nlogo.api.ConfigurableModelLoader.readModel(ModelLoader.scala:106)
 at org.nlogo.headless.HeadlessWorkspace.open(HeadlessWorkspace.scala:502)
 at org.nlogo.ls.HeadlessChildModel.$anonfun$new$1(HeadlessChildModel.scala:73)
 at org.nlogo.ls.HeadlessChildModel.$anonfun$new$1$adapted(HeadlessChildModel.scala:73)
 at org.nlogo.ls.ChildModel.openModelWithoutGenerator(ChildModel.scala:140)
 at org.nlogo.ls.HeadlessChildModel.<init>(HeadlessChildModel.scala:73)
 at org.nlogo.ls.LevelSpace.createHeadlessModel(LevelSpace.scala:106)
 at org.nlogo.ls.LevelSpace.$anonfun$load$1(LevelSpace.scala:53)
 at org.nlogo.ls.CreateModels.$anonfun$perform$5(Prims.scala:189)
 at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:158)
 at org.nlogo.ls.CreateModels.perform(Prims.scala:188)
 at org.nlogo.prim._extern.perform(_extern.java:36)
 at org.nlogo.nvm.Context.stepConcurrent(Context.java:107)
 at org.nlogo.nvm.ConcurrentJob.step(ConcurrentJob.scala:65)
 at org.nlogo.job.JobThread.runPrimaryJobs(JobThread.scala:133)
 at org.nlogo.job.JobThread.$anonfun$run$1(JobThread.scala:68)
 at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
 at scala.util.control.Exception$Catch.apply(Exception.scala:228)
 at org.nlogo.api.Exceptions$.handling(Exceptions.scala:41)
 at org.nlogo.job.JobThread.run(JobThread.scala:66)

probably just a simple matter of wrapping the exception.