Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Class Design Question
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01054128
Message ID:
01054202
Views:
16
What about:
function A() as Boolean
if not B()
  * Use sErrMsg to warn the user, if desired
  return .f.
endif

function B() as Boolean
local llSuccess
try && Whatever you need
....
llSuccess = this.C()
....
catch to loException && Optionally you can use When
  this.bErrorOcurred = .t.
  this.sErrMsg = loException.Message
finally && Whatever you need
endtry
return llSuccess



function C() as Boolean
local llSuccess
try && Whatever you need
....
llSuccess = this.D()
....
catch to loException && Optionally you can use When
  this.bErrorOcurred = .t.
  this.sErrMsg = loException.Message
finally && Whatever you need
endtry
return llSuccess


function D() as Boolean
local llSuccess
try && Whatever you need
....
  if not CheckForExistanceOfRecord
    this.bErrorOcurred = .t.
    this.sErrMsg = 'Some message indicating the failure to locate the record'
  endif
....
catch to loException && Optionally you can use When
  this.bErrorOcurred = .t.
  this.sErrMsg = loException.Message
finally && Whatever you need
endtry
return llSuccess
>>>If I create a class, and method A calls method B, which calls C which calls D,
>>>and an error occurs in D, either syntactically or otherwise, I would like to be
>>>able to recover to a usefull state.
>>>
>>>I generally use a properties called .bErrorOccured and .sErrmsg to indicate
>>>the error.
>>>
>>>But where do you go from there?
>>
>>Use try catch in the method A.
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform