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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Handling Advice 1

Status
Not open for further replies.

drosenkranz

Programmer
Sep 13, 2000
360
0
0
US
I have an error handling procedure stored in a prg with a bunch of other procedures. I have an On ERROR DO MyErrProc in a form's command button. The procedure runs correctly and displays the messages I want. I need advice on options in program control upon return to the code that originally caused the error.

Is there a way to tell if an error has occurred once you RETURN from the err handling procedure?

All I can think of seams lame:


ON ERROR DO MyErrProc
Public gl_Did_Error_Occur
gl_Did_Error_Occur = .F.

Then I place a line of code setting gl_Did_Error_Occur = .T. in the error handling procedure when an error occurs.

This means I have to include an IF statement after every file operation or other potential error causing event to evaluate gl_Did_Error_Occur to see if an error occurred and take the action within the IF statement.

Tell me there's an easier way... please. (I'm new to VFP)
 
I don't know how you need that, and why don't you put this code into the procedure. But, may be will be helpfully to you to an error method of each object.
Note: This event overrides the current ON ERROR routine and allows each object to trap and handle errors internally.

Dario
 
Check out the folowing link, this may give you some insight into error handling:


Weedz (The Grassman)
veld4663@exact.nl

They cling emotionally to code and fix development rather than choosing practices based on analytical assesments of what works best.

After the GoldRush - Steve McConnell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top