Faq on JS Errors

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MC

    Faq on JS Errors

    Thats a nice FAQ but it doesn't really help too much. How would you capture
    js errors after the page has loaded? If I knew that, I could send them back
    to a server via ajax and record them, so they could be fixed.

    Any ideas on that?
    MC


  • Peter Michaux

    #2
    Re: Faq on JS Errors

    On Jul 29, 9:09 am, "MC" <mica[removethis]@aisus.comwrote :
    Thats a nice FAQ
    Which FAQ?
    but it doesn't really help too much. How would you capture
    js errors after the page has loaded? If I knew that, I could send them back
    to a server via ajax and record them, so they could be fixed.
    This is not a frequent question.
    Any ideas on that?
    try-catch

    Peter

    Comment

    • MC

      #3
      Re: Faq on JS Errors


      "Peter Michaux" <petermichaux@g mail.comwrote in message
      news:1d96d7d9-6398-4359-823a-be106650e25b@q2 8g2000prh.googl egroups.com...
      On Jul 29, 9:09 am, "MC" <mica[removethis]@aisus.comwrote :
      >Thats a nice FAQ
      >
      Which FAQ?
      >
      >but it doesn't really help too much. How would you capture
      >js errors after the page has loaded? If I knew that, I could send them
      >back
      >to a server via ajax and record them, so they could be fixed.
      >
      This is not a frequent question.
      >
      >Any ideas on that?
      >
      try-catch
      >
      Peter
      So there is no error stack that I can access?
      Something like document.error[0]....?
      MC


      Comment

      • Peter Michaux

        #4
        Re: Faq on JS Errors

        On Jul 29, 10:29 am, "MC" <mica[removethis]@aisus.comwrote :
        "Peter Michaux" <petermich...@g mail.comwrote in message
        >
        news:1d96d7d9-6398-4359-823a-be106650e25b@q2 8g2000prh.googl egroups.com...
        >
        >
        >
        On Jul 29, 9:09 am, "MC" <mica[removethis]@aisus.comwrote :
        Thats a nice FAQ
        >
        Which FAQ?
        >
        but it doesn't really help too much. How would you capture
        js errors after the page has loaded? If I knew that, I could send them
        back
        to a server via ajax and record them, so they could be fixed.
        >
        This is not a frequent question.
        >
        Any ideas on that?
        >
        try-catch
        >
        Peter
        >
        So there is no error stack that I can access?
        Something like document.error[0]....?
        There is an (Java) error stack available in Rhino.

        The MDN Web Docs site provides information about Open Web technologies including HTML, CSS, and APIs for both Web sites and progressive web apps.


        Peter

        Comment

        • slebetman

          #5
          Re: Faq on JS Errors

          On Jul 30, 12:09 am, "MC" <mica[removethis]@aisus.comwrote :
          Thats a nice FAQ but it doesn't really help too much. How would you capture
          js errors after the page has loaded? If I knew that, I could send them back
          to a server via ajax and record them, so they could be fixed.
          >
          Try handling the error event:

          window.onerror = function (err,url,lineNu mber) {
          sendByAjax(err+ ", at:"+url+", line:"+lineNumb er);
          }

          see:

          The error event is fired on a Window object when a resource failed to load or couldn't be used — for example if a script has an execution error.

          Comment

          • Thomas 'PointedEars' Lahn

            #6
            Re: Faq on JS Errors

            slebetman wrote:
            On Jul 30, 12:09 am, "MC" <mica[removethis]@aisus.comwrote :
            >Thats a nice FAQ but it doesn't really help too much. How would you capture
            >js errors after the page has loaded? If I knew that, I could send them back
            >to a server via ajax and record them, so they could be fixed.
            >
            Try handling the error event:
            >
            window.onerror = function (err,url,lineNu mber) {
            sendByAjax(err+ ", at:"+url+", line:"+lineNumb er);
            }
            >
            see:
            >
            http://developer.mozilla.org/en/docs/DOM:window.onerror
            The onerror event handler is proprietary and unreliable. Therefore it
            should only serve as a fallback for exception handling.

            It should also be noted that syntax errors cannot be handled either way.


            PointedEars
            --
            Use any version of Microsoft Frontpage to create your site.
            (This won't prevent people from viewing your source, but no one
            will want to steal it.)
            -- from <http://www.vortex-webdesign.com/help/hidesource.htm>

            Comment

            Working...