Loading ...
Sorry, an error occurred while loading the content.

Logger and window.onerror

Expand Messages
  • xurizaemon
    I wrote a simple window.onerror handler to log my errors to disk, so I could test user errors. However, I found that the error messages appear only in the
    Message 1 of 1 , Apr 3, 2007
    • 0 Attachment
      I wrote a simple window.onerror handler to log my errors to disk, so I
      could test user errors. However, I found that the error messages
      appear only in the Logger window if I included the logger.js after
      setting window.onerror.

      My onerror function was still called, but all its supplied arguments
      were undefined.

      That's OK, I can work around it by calling the Logger code in my own
      window.onerror handler, and defining YAHOO Logger's window.onerror
      before mine.

      I'd like to be able to have them co-exist without one having to handle
      or call the other. Is this possible - for there to be two
      window.onerror handlers that co-operate, whether or not the other exists?

      After calling YAHOO's Logger.js, window.onerror is set to,

      try {
      YAHOO.widget.Logger.log(sMsg + " (" + sUrl + ", line " + sLine +
      ")", "window");
      if (YAHOO.widget.Logger._origOnWindowError) {
      YAHOO.widget.Logger._origOnWindowError(); }
      } catch (e) {
      return false;
      }

      This resulted in my error handler getting called (if defined before
      YAHOO's), but without the crucial sUrl, sLine and sMsg arguments.
    Your message has been successfully submitted and would be delivered to recipients shortly.