Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to handle errors
Message
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00586384
Message ID:
00586460
Views:
17
I think I'm not being clear. Maybe because I'm rather confused by all this myself. :)

Anyway, I don't want to return false, I want to return my result object. That part I can handle. The part I am having trouble with is letting the code that caused the error know an error has occured. The old way I would have done it is like this:
PUBLIC glWasError
ON ERROR glWasError = .T.
USE tablename
ON ERROR
IF glWasError
  *-- Use AERROR to get the info and then deal with it
ENDIF
With doing things the OOP way, I don't have the ON ERROR anymore. Instead, if the USE fails, it goes to the error method.

So I have:
USE tablename
IF ?????  && An error occurred
  loResult.lSucceded = .F.
  loResult.cError = ???????
ELSE
  loResult.lSucceded = .T.
ENDIF

RETURN loResult
What I don't know is how to make the IF statement know there was an error and what that error is.

Thanks,

Michelle


>Hi Michelle,
>
>How about returning a .F. from the DataOpen Method? Passing the return value (.F. in this case) up the calling chain. Your error handler can trap the error and do whatever action you require.
>
>Robert
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform