From 6810d92b688d044fba487789de8e844ff8585585 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Thu, 29 Aug 2013 08:37:31 +0200 Subject: [PATCH] Say what entity load failed and why in a nicer manner. --- src/com/massivecraft/mcore/store/Coll.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/com/massivecraft/mcore/store/Coll.java b/src/com/massivecraft/mcore/store/Coll.java index decb1f00..0a93d1a9 100644 --- a/src/com/massivecraft/mcore/store/Coll.java +++ b/src/com/massivecraft/mcore/store/Coll.java @@ -18,8 +18,10 @@ import com.massivecraft.mcore.MPlugin; import com.massivecraft.mcore.NaturalOrderComparator; import com.massivecraft.mcore.Predictate; import com.massivecraft.mcore.store.accessor.Accessor; +import com.massivecraft.mcore.util.Txt; import com.massivecraft.mcore.xlib.gson.Gson; import com.massivecraft.mcore.xlib.gson.JsonElement; +import com.massivecraft.mcore.xlib.gson.JsonSyntaxException; public class Coll implements CollInterface { @@ -498,7 +500,19 @@ public class Coll implements CollInterface this.clearIdentifiedChanges(id); - Entry entry = this.getDriver().load(this, id); + Entry entry = null; + try + { + entry = this.getDriver().load(this, id); + } + catch (JsonSyntaxException e) + { + MCore.get().log(Txt.parse("Database could not load entity. Invalid JSON syntax. You edited a file manually and did it wrong?")); + MCore.get().log(Txt.parse("Error: %s", e.getMessage())); + MCore.get().log(Txt.parse("Entity: %s", id)); + MCore.get().log(Txt.parse("Collection: %s", this.getName())); + return; + } if (entry == null) return; JsonElement raw = entry.getKey();