OsmAnd/DataExtractionOSM/src/com/osmand/ExceptionHandler.java
Victor Shcherb 5fc0951cf8 add transport route search
git-svn-id: https://osmand.googlecode.com/svn/trunk@161 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
2010-06-14 21:14:36 +00:00

43 lines
959 B
Java

package com.osmand;
import javax.swing.JOptionPane;
import org.apache.commons.logging.Log;
import com.osmand.swing.OsmExtractionUI;
public class ExceptionHandler {
private static final Log log = LogUtil.getLog(ExceptionHandler.class);
public static void handle(Throwable e){
handle("Error occurred", e);
}
public static void handle(String msg, Throwable e){
if(e != null){
log.error(msg, e);
} else {
log.error(msg);
}
if(e != null){
e.printStackTrace();
}
if (OsmExtractionUI.MAIN_APP != null && OsmExtractionUI.MAIN_APP.getFrame() != null) {
String text;
String title;
if (e != null) {
text = e+" ";
title = msg;
} else {
title = "Error occured";
text = msg;
}
JOptionPane.showMessageDialog(OsmExtractionUI.MAIN_APP.getFrame(), text, title, JOptionPane.ERROR_MESSAGE);
}
}
public static void handle(String msg){
handle(msg, null);
}
}