This application has encountered an error …

I am resuming an old post:
This application ha encountered an error..etc (also quoting This application has encountered an error ... and Can I replace the "This application has encountered an error and cannot continue." ) to ask if there is a way to prevent the black window with “Send/Don’t Send” from being shown to the user.
It is a really ugly thing (I believe unique in the www) and also it annoys and confuses the user.
I would like to replace it with a window managed by myself.
I thank anyone who can and will give me suggestions.

Just wanted to note that the dark window with Send / Don’t Send is a Web 1.0 feature, it does not appear in Web 2.0.

In Web 1.0, this dialog is the result of not handling a RuntimeException or a JavaScript error. You can suppress the dialog and use your own just like you would with the Desktop framework, by returning True in the UnhandledException event or JavaScriptError event.

Slight difference to the Desktop framework, there is an UnhandledException event on both the App object an the Session object. This allows you to finely tune your general exception recovery. Returning True in either event suppresses the user-facing error dialog.

With all that said, you are much better off figuring out why you’re getting an unhandled RuntimeException. The UnhandledException event is meant to be used as last-chance recovery effort.

If you are getting a JavaScript error, you’ll need to fix the JavaScript. I have seen this occur with JavaScript errors in the framework, but they are difficult to reproduce and Xojo no longer effectively supports Web 1.0.