• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

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.
  • T Offline
    thomthom
    last edited by 4 Nov 2012, 20:18

    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
    • T Offline
      thomthom
      last edited by 4 Nov 2012, 21:22

      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 4 Nov 2012, 21:36

        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
        • T Offline
          thomthom
          last edited by 4 Nov 2012, 21:55

          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 16 Nov 2012, 01:15

            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
            • D Offline
              Dan Rathbun
              last edited by 16 Nov 2012, 03:33

              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