问题
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