Error Handling
So Dennis mentioned that Silly Freak greatly improved the error reporting system? That sounds really good. It would be nice when there was an error if MTG Forge saves the error to a file or sends an e-mail if the player is online.
High Quality Resources for Collectible Card Games
https://www.slightlymagic.net/forum/
https://www.slightlymagic.net/forum/viewtopic.php?f=52&t=1528
/**
* ExceptionHandler.java
*
* Created on 27.09.2009
*/
package forge.error;
import java.lang.Thread.UncaughtExceptionHandler;
/**
* This class handles all exceptions that weren't caught by showing the error to the user.
*/
public class ExceptionHandler implements UncaughtExceptionHandler {
static {
//Tells Java to let this class handle any uncaught exception
Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler());
//Tells AWT to let this class handle any uncaught exception
System.setProperty("sun.awt.exception.handler", ExceptionHandler.class.getName());
}
/**
* Call this at the beginning to make sure that the class is loaded and the static initializer has run
*/
public static void registerErrorHandling() {
System.out.println("Error handling registered!");
}
@Override
public void uncaughtException(Thread t, Throwable ex) {
ErrorViewer.showError(ex);
}
/**
* This Method is called by AWT when an error is thrown in the event dispatching thread and not caught.
*/
public void handle(Throwable ex) {
ErrorViewer.showError(ex);
}
}
ExceptionHandler.registerErrorHandling();
public static void main(String[] args) {
ExceptionHandler.registerErrorHandling();
try {
Object[] o = UIManager.getInstalledLookAndFeels();