2,10 → 2,26 |
|
import com.extjs.gxt.ui.client.GXT; |
import com.google.gwt.core.client.EntryPoint; |
import com.google.gwt.core.client.GWT; |
import com.google.gwt.user.client.Window; |
|
public class Coel implements EntryPoint { |
|
public void onModuleLoad() { |
|
// A décommenter + compiler en detailed dans le cas d'une erreur |
// survernant uniquement sur le serveur |
GWT.setUncaughtExceptionHandler(null); |
GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() { |
@Override |
public void onUncaughtException(Throwable e) { |
Window.alert("uncaught: " + e.getMessage()); |
String s = buildStackTrace(e, "RuntimeException:\n"); |
Window.alert(s); |
e.printStackTrace(); |
} |
}); |
|
// Fermeture du panneau de chargement de l'appli |
GXT.hideLoadingPanel("loading"); |
|
18,7 → 34,36 |
System.out.println("-------------------------------------------------------------------"); |
System.out.println(""); |
} |
} |
|
private String buildStackTrace(Throwable t, String log) { |
if (t != null) { |
log += t.getClass().toString(); |
log += t.getMessage(); |
// |
StackTraceElement[] stackTrace = t.getStackTrace(); |
if (stackTrace != null) { |
StringBuffer trace = new StringBuffer(); |
|
for (int i = 0; i < stackTrace.length; i++) { |
trace.append(stackTrace[i].getClassName() + "." + stackTrace[i].getMethodName() + "(" |
+ stackTrace[i].getFileName() + ":" + stackTrace[i].getLineNumber()); |
} |
|
log += trace.toString(); |
} |
// |
Throwable cause = t.getCause(); |
if (cause != null && cause != t) { |
log += buildStackTrace(cause, "CausedBy:\n"); |
} |
} |
return log; |
} |
|
public static native void LogVersFirebug(String s) /*-{ |
if (!!($wnd.console && $wnd.console.log)) { |
console.log(s); |
} |
}-*/; |
} |