|
Post by Miklos Nemeth on Nov 5, 2005 3:48:04 GMT -5
I'm using your great library, and found that exceptions are not propagated from event handlers to the event handler of the procedure that had raised the event Here is a small demo of what happens: ' The EventProducer class Public Event AnEvent() Public Sub DoSomething() On Error GoTo exception RaiseEvent AnEvent Exit Sub exception: MsgBox Err.Description & " from " & Err.Source End Sub ' The event handler class (ErrorThrower) Private WithEvents anEventProducer As EventProducer Private Sub anEventProducer_AnEvent() Err.Raise 997, "ErrorThrower.anEventProducer_AnEvent", "Exception" End Sub The exception 997 never caught by the error handler in DoSomething. Am I missing something here? Thank you, Miklos
|
|
|
Post by Kelly Ethridge on Nov 5, 2005 5:43:46 GMT -5
Hello Miklos,
VB does not propagate errors up from event handlers back to the event calling RaiseEvent. This is by VB degisn. You have to handle errors within the event procedure or else your application will crash. Using VBCorLib cannot go around this.
Kelly
|
|
|
Post by Miklos Nemeth on Nov 6, 2005 12:28:44 GMT -5
Thank You, Kelly. One more question about exception handling: Is it possible with your great library to display a stack trace when an exception is caught?
Thank you, Miklos
|
|