Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Handling in Visual FoxPro

Status
Not open for further replies.

kunigenas

Programmer
May 30, 2000
1
US
I'm looking for good technique to follow for error handling in a VFP application.&nbsp;&nbsp;I recently downloaded an article written by Doug Hennig on the subject.&nbsp;&nbsp;I understand the general concepts; however, I'm having some trouble understanding the whole article.<br><br>Do you know of any other articles written on the subject or could give me some steps or advice to follow to get started in writing an effective error handler for my application.<br><br>
 
Remember you can always implement the same global error handler (GEH) as you did in FPW.&nbsp;&nbsp;ON ERROR DO &lt;myerrhandler&gt; WITH ERROR(), etc.&nbsp;&nbsp;From Doug's article you saw that errors occurring in objects invoke it's error event.&nbsp;&nbsp;If there is no code there it looks for code up the parentclass hiearchy to the vfp baseclass, not the not up the parent container like a form unless you direct it;&nbsp;&nbsp;This.Parent.Error(nError, cMethod, nLine) or Thisform.Error(nError, cMethod, nLine).&nbsp;&nbsp;Still, if no code is found, your GEH will still be called if there is one.&nbsp;&nbsp;You can trap errors in your ojects with case statements and still call a geh if needed with the parameters passed to the object:<br>OTHERWISE<br>&nbsp;&nbsp;DO myerrhandler WITH nError, cMethod, nLine<br>ENDCASE<br>I found his resolution returning scheme a little cumbersome too.&nbsp;&nbsp;Then again his code is for a framework so it has to cover all bases.<br>One more point involves issuing your READ EVENTS from an object like an application object and RETURN TO MASTER but I am guessing you dont want to go there.<br>Do you need specific code for update confilcts, triggers, etc or are you just looking for a simpler error handling scheme and can handle the specific errors?&nbsp;&nbsp;<br><br>LMK if this was helpful or just more confusing :(,<br>John Durbin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top