squeek502 / SpiceOfLife

A Minecraft mod that encourages dietary variety through diminishing returns
The Unlicense
23 stars 27 forks source link

Non-JSON files in SpiceOfLife folder cause crash #98

Closed Syndaryl closed 8 years ago

Syndaryl commented 8 years ago

I put an xlsx file in my SpiceOfLife folder with my equations I used to test and calculate the various diminishing returns formulas I'm using. This makes Minecraft crash with com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:176) at com.google.gson.Gson.fromJson(Gson.java:803) at com.google.gson.Gson.fromJson(Gson.java:741) at squeek.spiceoflife.foodtracker.foodgroups.FoodGroupConfig.load(FoodGroupConfig.java:87) at squeek.spiceoflife.ModSpiceOfLife.postInit(ModSpiceOfLife.java:91)

(pretty sure you don't need the rest after here)

Could you catch com.google.gson.JsonSyntaxException and spit out the file name you're trying to parse along with the stack trace? It would make it a lot easier to figure out what Minecraft is babbling about :)

squeek502 commented 8 years ago

Silly me, sorry about that. Will fix.