How to disable YUI2 silent failing?

淺唱寂寞╮ 提交于 2019-12-11 04:44:32

问题


YUI 2 often fails silently, e.g. when you expect the this to be another object and call an unexisting method on it. Is there any way make errors "visible"?


回答1:


If your code is running in a YUI event handler, then YUI catches the exception and you won't see it in the debugger.

To see these exceptions, you either need to catch the exception yourself and output something to the debug console or turn on the right logging in YUI so it outputs the exceptions. I've looked for the right logging settings to see these exceptions and not found it yet, but it seems like a logical thing that they would support since there are many other logging settings.

One thing you can try is to call this: YAHOO.widget.Logger.enableBrowserConsole() when used with the debug version of the YUI library. Then, look for debug output in the Firebug, Safari or Chrome console.




回答2:


To answer my own question. It's simple as this:

YAHOO.widget.Logger.enableBrowserConsole();
YAHOO.util.Event.throwErrors = true;



来源:https://stackoverflow.com/questions/8231828/how-to-disable-yui2-silent-failing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!