viash-io / viash

script + metadata = standalone component
https://viash.io
GNU General Public License v3.0
39 stars 2 forks source link

Nasty stacktrace when merge yaml is invalid #539

Closed rcannood closed 1 year ago

rcannood commented 1 year ago

When using __merge__ to merge a yaml into a viash config but the YAML to be merged is invalid, we get a nasty stacktrace. Here is an example:

Content of config.vsh.yaml:

functionality:
  name: foo
  __merge__: bad.yaml

Content of bad.yaml:

one: foo
/wqwqws

Terminal log:

$ viash config view config.vsh.yaml
Unexpected error occurred! If you think this is a bug, please post
create an issue at https://github.com/viash-io/viash/issues containing
a reproducible example and the stack trace below.

viash - 0.8.0
Stacktrace:
java.util.NoSuchElementException: None.get
        at scala.None$.get(Option.scala:627)
        at scala.None$.get(Option.scala:626)
        at io.viash.helpers.circe.RichJson.$anonfun$inherit$5(RichJson.scala:201)
        at scala.collection.immutable.List.map(List.scala:246)
        at io.viash.helpers.circe.RichJson.inherit(RichJson.scala:193)
        at io.viash.helpers.circe.RichJson.$anonfun$inherit$7(RichJson.scala:219)
        at io.circe.JsonObject$MapAndVectorJsonObject.$anonfun$mapValues$1(JsonObject.scala:428)
        at scala.collection.Iterator$$anon$9.next(Iterator.scala:584)
        at scala.collection.mutable.Growable.addAll(Growable.scala:62)
        at scala.collection.mutable.Growable.addAll$(Growable.scala:57)
        at scala.collection.immutable.MapBuilderImpl.addAll(Map.scala:690)
        at scala.collection.immutable.Map$.from(Map.scala:641)
        at scala.collection.immutable.Map$.from(Map.scala:171)
        at scala.collection.MapOps.map(Map.scala:299)
        at scala.collection.MapOps.map$(Map.scala:299)
        at scala.collection.AbstractMap.map(Map.scala:405)
        at io.circe.JsonObject$MapAndVectorJsonObject.mapValues(JsonObject.scala:427)
        at io.viash.helpers.circe.RichJson.inherit(RichJson.scala:219)
        at io.viash.config.Config$.readFromUri(Config.scala:206)
        at io.viash.config.Config$.read(Config.scala:180)
        at io.viash.Main$.readConfig(Main.scala:419)
        at io.viash.Main$.mainCLI(Main.scala:320)
        at io.viash.Main$.mainCLIOrVersioned(Main.scala:123)
        at io.viash.Main$.main(Main.scala:58)
        at io.viash.Main.main(Main.scala)

Thanks to @danielStrobl for finding and reporting this error!

Grifs commented 1 year ago

This issue will be resolved in Viash 0.9.0