Skip to content

Commit

Permalink
Added more descriptive error messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe12o committed Feb 4, 2014
1 parent 62de5d5 commit 81eb9a2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
6 changes: 4 additions & 2 deletions src/main/java/com/skcraft/alicefixes/AliceTransformer.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.logging.Level;

Expand Down Expand Up @@ -43,8 +44,9 @@ public AliceTransformer() {
}
}
}
} catch(Throwable t) {
t.printStackTrace();
} catch(IOException e) {
FMLLog.log("AliceFixes", Level.WARNING, "%s", "Error while loading the patches file: " + e);
e.printStackTrace();
}
}

Expand Down
20 changes: 12 additions & 8 deletions src/main/java/com/skcraft/alicefixes/Blacklist.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import cpw.mods.fml.common.FMLLog;
import org.apache.commons.io.FileUtils;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;

public class Blacklist {

Expand All @@ -28,8 +27,12 @@ public static void load(File configDir) {
}
br.close();
}
catch(Throwable t) {
t.printStackTrace();
catch(FileNotFoundException e) {
FMLLog.log("AliceFixes", Level.WARNING, "%s", "Failed to find blacklists file!");
}
catch(IOException e) {
FMLLog.log("AliceFixes", Level.WARNING, "%s", "Error while loading the blacklists file: " + e);
e.printStackTrace();
}
}

Expand All @@ -38,8 +41,9 @@ public static void save() {
try {
lists.setBlacklists(blacklists);
FileUtils.writeStringToFile(config, gson.toJson(lists));
} catch(Throwable t) {
t.printStackTrace();
} catch(IOException e) {
FMLLog.log("AliceFixes", Level.WARNING, "%s", "Error saving the blacklists file: " + e);
e.printStackTrace();
}
}

Expand Down
7 changes: 5 additions & 2 deletions src/main/java/com/skcraft/alicefixes/util/ASMHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.skcraft.alicefixes.AliceTransformer;
import com.skcraft.alicefixes.Blacklist;
import cpw.mods.fml.common.FMLLog;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
Expand All @@ -12,6 +13,7 @@
import org.objectweb.asm.MethodVisitor;

import java.lang.reflect.Method;
import java.util.logging.Level;

import static org.objectweb.asm.Opcodes.*;

Expand Down Expand Up @@ -89,8 +91,9 @@ private static boolean fireEvent(EntityLivingBase player, int x, int y, int z) {
}
breakEvt.setCancelled(true);
}
} catch(Exception e) {
e.printStackTrace();
} catch(Throwable t) {
FMLLog.log("AliceFixes", Level.SEVERE, "%s", "Error while firing Bukkit event: " + t);
t.printStackTrace();
}
return true;
}
Expand Down

0 comments on commit 81eb9a2

Please sign in to comment.