views:

292

answers:

1

Does anyone know how to get the below to report a javascript error? (any browser)


<head>
    <title></title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js"&gt;
    </script>
    <script type="text/javascript">

        ObjWithEvent = {
            testEvent: new YAHOO.util.CustomEvent("testEvent")
        };

        ObjSubscriber = {
            handleTestEvent: function(){
                alert('the next line will not show up in the error console');
                not_a_valid_function_bro();
            }
        };

        ObjWithEvent.testEvent.subscribe(ObjSubscriber.handleTestEvent);
        ObjWithEvent.testEvent.fire();
    </script>
</head>
<body>
</body>

+5  A: 

Possibly one of the worst chosen default settings ever..... YAHOO.util.Event.throwErrors is set to false by default, so if you want to see errors:

YAHOO.util.Event.throwErrors = true;

jayrdub