ksandom / handWavey

A more intuitive/usable desktop control using leapmotion/ultraleap.
https://www.randomksandom.com/handWavey/
GNU General Public License v3.0
21 stars 1 forks source link

Bad YAML causes crash that is hard to trace #73

Open ksandom opened 7 months ago

ksandom commented 7 months ago

Problem

If you forget to put in the key, like this

  special-primaryMoving:
    simpleMovingProtection-enable();

instead of this

  special-primaryMoving:
    value: simpleMovingProtection-enable();

You get this

Exception in thread "main" java.lang.ClassCastException: class java.lang.String cannot be cast to class java.util.Map (java.lang.String and java.util.Map are in module java.base of loader 'bootstrap')
        at config.Persistence.walkInput(Persistence.java:173)
        at config.Persistence.load(Persistence.java:119)
        at config.Persistence.load(Persistence.java:103)
        at config.Config.load(Config.java:71)
        at config.Config.load(Config.java:55)
        at handWavey.HandWaveyManager.loadAndSaveConfigToDisk(HandWaveyManager.java:96)
        at handWavey.HandWaveyManager.initialSetup(HandWaveyManager.java:80)
        at handWavey.HandWaveyManager.<init>(HandWaveyManager.java:68)
        at handWavey.HandWavey.main(HandWavey.java:16)

Task

Detect this, and output enough information that a user would be able to solve it.