GWT 产品模式 AssertionException 捕获?如何?
在 GWT 的产品模式下,断言不可用,这很好,但由于 GXT 错误,我收到断言错误,并且因为必要的类不可用,我得到的只是 com.google.gwt.core.client.JavaScriptException 错误在浏览器中,仅仅正确调试它是不够的。我需要这个的原因是因为在我的自定义框架中,我创建了一个负责错误处理的类,
GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
@Override
public void onUncaughtException(Throwable e) {
addError(e);
}
});
public void addError(Throwable ex)
{
if(!ex.getClass().equals(AssertionError.class))//(ex instanceof AssertionError))
{
this.addError(ex, true);
}
}
正如您所看到的,我已尝试捕获错误,但在生产模式下无法捕获错误。我以某种方式需要能够指定异常,以便我可以过滤它。所有错误都会进入日志,我不希望这些错误出现在那里
GXT Error => http://www.sencha.com/forum/showthread .php?171409-RowEditor-AssertionError&p=709005
感谢
Egg 的帮助
in product mode in GWT the assertion is not available which is good, but because of a GXT error I get an assertion error and because the necessary classes are not available all I get is a com.google.gwt.core.client.JavaScriptException error in the browser and it's not enough to properly debug it. The reason why I need this is because in my custom framework I created a class that's responsible for error handling
GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
@Override
public void onUncaughtException(Throwable e) {
addError(e);
}
});
public void addError(Throwable ex)
{
if(!ex.getClass().equals(AssertionError.class))//(ex instanceof AssertionError))
{
this.addError(ex, true);
}
}
as you can see I've tried to capture the error but I'm unable to in production mode. I somehow need to be able to sepcify the exception so I can filter it. All errors get into the logs and I don't want these errors to appear there
GXT Error => http://www.sencha.com/forum/showthread.php?171409-RowEditor-AssertionError&p=709005
thanks help
By Egg
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要在编译的代码中启用断言,这与使用
-ea
标志在标准 jvm 中执行此操作非常相似。不过,不需要将其传递给 jvm,而是需要将其传递给 Compiler 类(或者如果从 eclipse 或其他工具运行,则将其放入程序参数中)。请参阅 http://code.google.com/webtoolkit/doc/latest/ DevGuideCompilingAndDebugging.html#DevGuideCompilerOptions 获取可以传递给编译器的所有参数的列表
You need to enable assertions in your compiled code, and this is done very similarly to how you would do this in a standard jvm, using the
-ea
flag. Instead of passing this to the jvm though, it needs to be passed to the Compiler class (or put in the program args if running from eclipse, or some other tool).See http://code.google.com/webtoolkit/doc/latest/DevGuideCompilingAndDebugging.html#DevGuideCompilerOptions for the list of all args you can pass to the compiler