sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Make OSX WebDialog alert of script errors?

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 4 Posters 88 Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • thomthomT Offline
      thomthom
      last edited by

      I find that when an error happen in an OSX WebDialog the messages are silently eaten. Is there a way to make it pop up an alert, like under Windows IE?

      Thomas Thomassen β€” SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        No window.onerror for Safari it appears. Googling and checking stackoverflow.

        Thomas Thomassen β€” SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • A Offline
          Aerilius
          last edited by

          In internet explorer we can redirect popup errors to the Ruby Console, so I guess Safari would also trigger the onerror handler?

          window.onerror = function(errorMsg, url, lineNumber){ 
            Dialog.callRuby("puts", errorMsg, url, lineNumber); // or whatever callback...
            return true; // This prevents tells the browser the error needs no further handling (no popup).
          }
          
          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            Maybe this can work: http://extechops.net/2011/07/04/generic-onerror/

            ?

            Thomas Thomassen β€” SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • D Offline
              driven
              last edited by

              error alerts like this work

              wwhdlg = UI;;WebDialog.new("wot_works_here", true, "wwh", 739, 641, 50, 50, true);
               wwhdlg.set_url "http://www.eborcom.com/webmaker/tutorials/rhoque/ex2_5.html"
               wwhdlg.show_modal 
               wwhdlg.navigation_buttons_enabled=true
              

              learn from the mistakes of others, you may not live long enough to make them all yourself...

              1 Reply Last reply Reply Quote 0
              • Dan RathbunD Offline
                Dan Rathbun
                last edited by

                The MSDN page says there are no standards that apply to onerror (its IE only.)

                You could it on both the document and window objects just to be sure.

                If Safari is DOM Level 3, then you may need to use:
                %(#8000BF)[window.addEventListener("error",*fHandlerName*,*bCapture*)]
                [window.addEventListener](http://msdn.microsoft.com/en-us/library/ff975245(v)
                DOM Level 3: Error
                Example:
                http://msdn.microsoft.com/en-us/library/hh772306(v=vs.85).aspx

                Or you could %(#8000BF)[catch] the errors with JS:
                [url=http://msdn.microsoft.com/en-us/library/4yahc5d8(v=vs.85).aspx:3cyk4r6q]try ... catch ... finally[/url:3cyk4r6q]
                [url=http://msdn.microsoft.com/en-us/library/85fscz6h(v=vs.85).aspx:3cyk4r6q]throw[/url:3cyk4r6q]
                [url=http://msdn.microsoft.com/en-us/library/dww52sbt(v=vs.85).aspx:3cyk4r6q]Error object[/url:3cyk4r6q]

                I'm not here much anymore.

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement