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.onerror
for 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]
Advertisement