>Is it possible to specify an exception subclass for the Exception objects created by CATCH TO statement?
>
>In other words:
>
>
>local myException as myExceptionClass
>
>try
> code here ...
>
>catch to myException as myExceptionClass
> error handling code
>
>endtry
>
>
>Or (as I suspect), CATCH TO only creates objects of the base Exception class?
>
Yes.
Why? Because this open the myExceptionClass instantiation issue.
If myExceptionClass fire a nested error, the C++ routine go out of manage.
A solution is this:
myException=CREATEOB("myExceptionClass")
try
code here ...
catch to myException ADDITIVE
endtry
BUT with this restriction: no VFP code run during the filling (not _Assign executed )>If so, is there any scenario wher eit makes sense to subclass the base Exception class?
>
OOP elegance and speed.
Exception is the VFP baseclass with methods faster to being created.
then:
- Capture the error into a exceptionvar
- use a specific exception class to manage the exceptionvar.
>Thanks,
>Malcolm