Question Error Handling with Exceptions

swip

New Member
Hi, I want to throw Exceptions in my Code and what those to be catched by the start procedure.
The Problem I'm experiencing is the following.
My start_procedure.p is instantiating a System.Windows.Forms.Form and executing wait-for.
Code:
WAIT-FOR System.Windows.Forms.Application:Run(myObj).
In this form and in every other form or dialog I want to throw error and let them get catched by start_procudure.p.
I tried to delete the default catch from the constructor of the forms but it never returned to the procedure.
Is it even possible to achieve, what I want?
I found a workaround, where I run a static method of myObj.cls inside the Exceptions Constructors but I actually don't want to it this way.
 

peterjudge

Member
The AVM does not let errors "past the WAIT-FOR". If there are unhandled errors, the AVM will itself display any errors (or let .NET deal with them).

In .NET terms, you need to add catch blocks to all event handlers, and deal with the errors there. That could be showing errors in some form of dialogue box, or possibly keeping the errors for dealing with later. But if you want to deal with the errors after the WAIT-FOR terminates, you will need to keep them in variables or some other structure.

I found a workaround, where I run a static method of myObj.cls inside the Exceptions Constructors but I actually don't want to it this way

Not sure what this means. Do you display the error message from the exception's constructor? If so, I agree that this is probably not a good approach.
 
Top