Make OSX WebDialog alert of script errors?
-
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?
-
No
window.onerrorfor Safari it appears. Googling and checking stackoverflow. -
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). } -
Maybe this can work: http://extechops.net/2011/07/04/generic-onerror/
?
-
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 -
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).aspxOr 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]
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement