Chip Orange wrote:
I can't do it in a WE script however; it simply halts on the line having the error. I'm not using GWToolkit error handling in any way.

That code was very weirdly formatted. Either whoever wrote it was trying to make what he was doing look more mysterious, or he was just on crack.

The difference between WSH and Window-Eyes is that for whatever reason, WSH apparently doesn't try to handle that error by popping up a dialog box. We do. However, you can override that behavior for your script by offering to handle the OnError event yourself. Obviously, if you do that, you should be prepared to deal with errors that occur outside of your pseudo-try block, perhaps by deferring to the toolkit error handling in those cases. In my test, I just handled all errors by ignoring them completely. If you do this, though, note that we will still know the error happened, and we'll set your status to "Running with Errors" in the script manager.

Anyway, this code seems to do more or less what you expect with Window-Eyes:

' ======8<--- cut here ---------

Class CFunc1
  Private Sub Class_Initialize
     DoLog "Starting"
     Dim i : i = 65535 ^ 65535
     MsgBox "Should not see this"
  End Sub
  Private Sub CatchErr
     If Err.Number = 0 Then Exit Sub
     Select Case Err.Number
        Case 6 DoLog "Overflow handled!"
        Case Else DoLog "Unhandled error " & Err.Number & " occurred."
     End Select
     Err.Clear
  End Sub
  Private Sub Class_Terminate
     CatchErr
     DoLog "Exiting"
  End Sub
  Private Sub DoLog( a )
     MsgBox a
  End Sub
End Class

Sub OnError( path, name, desc, source, wcode, scode, line, column )
End Sub

ConnectEvent Script, "OnError", "OnError"

Dim Func1
Set Func1 = New CFunc1
Set Func1 = Nothing

' ======8<--- cut here ---------

Reply via email to