Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
To iif or not to iif = .t.
Message
From
08/06/2001 09:48:44
James Beerbower
James Beerbower Enterprises
Hochheim Am Main, Germany
 
 
To
07/06/2001 10:15:35
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00513276
Message ID:
00516870
Views:
18
>>
>>if  vartype(tMan) <> “C”
>>	Return this.throwerror(“Bad Man”)
>>else
>>	if vartype(tPhilosopher)<>”C”
>>		Return this.throwerror(“Bad Philosopher”)
>Ahem... Return this.throwerror(“Philosopher wihout character”) or Return this.throwerror(“Philosopher's character not variable”)?

Yes. Or better still:
this.throwerror(Program()+PARAMETER_ERR,lineno(),program()) Though "Philosopher without Character" sounds better. "Bad Philosopher!" only makes sense if "Philosopher" is your dogs name.

I've been trying to get away from the soft landing concept with error handling; or rather I want the error documented as soon as it occurs and then allow the calling object to handle the landing.

I really don't like
if  vartype(tMan) <> “C”
   * error
   return .f.
endif
Because
1. The program knows that there is an error that is just as serious as a syntax error.
2. and if the program does crash later then it will be much harder to track the error down.
3. If it doesn't crash then one could have a worse situation: bad data in the data base or incorrect results from the users point of view. I would rather see a hard crash than ship a 20,000$ chunk of metal to somebody who didn't ask for it.

ASSERT really doesn't help at all for this situation if you ask me. Its good in debugging but not once a bug has made it into production. Has anyone considered forcing foxpro errors at that point with the error() command or is that simply too ludicrous. From an OO point of view the method that identifies the error flag a property that identifies the area etc but I feel that if someone misuses the object interface there is a good chance that they won't check to see whether the object has an error. Maybe the strategy is to persuade the developers using my objects to check the error property of the object before major decision points?

Thanks for putting up with my rambling!
James Beerbower
James Beerbower Enterprises
Frankfurt, Deutschland
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform