简体   繁体   English

gwt延迟调度调试

[英]gwt deferred scheduling debugging

How can one efficiently debug a component that extensively uses the scheduleDeferred/scheduleFinally calls? 如何有效地调试广泛使用scheduleDeferred / scheduleFinally调用的组件? For some reason some calls get swallowed and don't get executed. 由于某些原因,某些调用会被吞噬,而无法执行。 One option in mind is try to simplify the scenario until reaching a minimal number of interactions. 记住的一种选择是尝试简化方案,直到达到最少数量的交互。 But even then, it's not easy to see why the calls get swallowed by the browser. 但是即使那样,也不容易知道为什么浏览器会吞下这些电话。

If an exception occurs inside a callback/deferred method, it might just get swallowed and will not execute the next deferred call. 如果在回调/延迟方法内部发生异常,则该异常可能会被吞下,并且不会执行下一个延迟调用。 Sometimes you will see a JavaScript exception, but I already saw code where no exception was shown at all and just execution of this deferred call was stopped - pretty hard to find the cause. 有时您会看到一个JavaScript异常,但是我已经看到了根本没有显示任何异常的代码,只是停止了此延迟调用的执行-很难找到原因。

I am just assuming you are using Super Dev Mode or running in production mode (compiled release) here, because in normal dev mode GWT should catch exceptions. 我只是假设您在这里使用Super Dev Mode或在生产模式下运行(编译版本),因为在正常的dev模式下,GWT应该捕获异常。

To protect against this, surround the content of every deferred call with a try/catch and either log or show a message if an exception occurs. 为了防止这种情况,请在每个延迟调用的内容周围添加try / catch,并在发生异常时记录或显示一条消息。 That even will show an error if your breakpoint gets not triggered correctly. 如果您的断点未正确触发,那甚至会显示一个错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM