GWT 产品模式 AssertionException 捕获?如何?

发布于 2024-12-25 01:39:17 字数 1009 浏览 2 评论 0原文

在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

送你一个梦 2025-01-01 01:39:17

您需要在编译的代码中启用断言,这与使用 -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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文