Loading...

java .net

GWT.setUncaughtExceptionHandler

GWT设置UncaughtExceptionHandler 以捕获为捕捉的异常,这gwt在host mode编译后的JavaScript如果出现错误,No errors in Hosted Mode and Compiled localy, but deployed to tomcat yields in errors
这是恼人,加上UncaughtExceptionHandler起码有一丝线索
GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
    public void onUncaughtException(Throwable throwable{
        String text = "Uncaught exception: ";
        while (throwable != null{
            StackTraceElement[] stackTraceElements = throwable
                    .getStackTrace();
            text += throwable.toString() + "\n";
            for (int i = 0i < stackTraceElements.lengthi++) {
                text += "    at " + stackTraceElements[i] + "\n";
            }
            throwable = throwable.getCause();
            if (throwable != null{
                text += "Caused by: ";
            }
        }
        System.err.print(text);
        text = text.replaceAll(" ", " ");
        Window.alert("系统错误:"+text);
    }
});

posted on 2010-05-19 10:18 阅读(356) 评论(0)  编辑  收藏 所属分类: gwt


只有注册用户登录后才能发表评论。


网站导航:
 

公告

希望有一天

我能用鼠标双击我的钱包

然后选中一张100元

按住“ctrl+c”

接着不停的“ctrl+v”

嘻嘻~~~笑醒~~~



导航

<2010年5月>
2526272829301
2345678
9101112131415
16171819202122
23242526272829
303112345

统计

常用链接

留言簿(6)

随笔分类(102)

随笔档案(398)

文章分类

文章档案(10)

有趣网络

搜索

积分与排名

最新评论

阅读排行榜

评论排行榜