From f21b0c85b9b50cdb770dae2a643bd0d990b694ec Mon Sep 17 00:00:00 2001 From: Oskar Wiksten Date: Thu, 2 Aug 2012 13:44:38 +0200 Subject: [PATCH] Provide whole stacktrace in log when a savegame fails to load. --- .../src/com/gpl/rpg/AndorsTrail/Savegames.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/Savegames.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/Savegames.java index 8c2ea49..ea91a53 100644 --- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/Savegames.java +++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/Savegames.java @@ -10,6 +10,8 @@ import java.io.FilenameFilter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.io.PrintWriter; +import java.io.StringWriter; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -59,8 +61,14 @@ public final class Savegames { fos.close(); return result; } catch (IOException e) { - L.log("Error loading world: " + e.toString()); - return LOAD_RESULT_UNKNOWN_ERROR; + if (AndorsTrailApplication.DEVELOPMENT_DEBUGMESSAGES) { + L.log("Error loading world: " + e.toString()); + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + e.printStackTrace(pw); + L.log("Load error: " + sw.toString()); + } + return LOAD_RESULT_UNKNOWN_ERROR; } } -- 2.50.1