Solved

On Error issue within project

Posted on 2011-09-12
4
334 Views
Last Modified: 2012-06-22
I have just setup up my "On Error do" error handling routine. Hence it was a small joy victory. When I use the command window and execute my programs the "On Error" clause works ok. When I build the project the "on Error" clause does nothing. Did anyone had this kind of issue. Is there any additional configuration to make on the project before building the executable file?
Kind regards
Lucilia Coelho
0
Comment
Question by:luciliacoelho
4 Comments
 
LVL 41

Accepted Solution

by:
pcelba earned 500 total points
ID: 36522231
This is a mistake in your code.

ON ERROR DO SomeProcedure WITH ....
requires the procedure to be in the main program (which contains READ EVENTS) or in a procedure file which is declared by SET PROCEDURE TO .... prior to the ON ERROR command

You could also have the error procedure designed as a standalone program by:

ON ERROR DO Program.PRG WITH ....

then the Program.PRG must be included in the project (and in EXE) and it must begin with parameters.

If you will post the exact format of your ON ERROR and tell where and how the error procedure is included in your project then we can tell more.
0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 36522340
If you only set ON ERROR in the IDE, in the command window, and not in your start program, the EXE does not use that error handling, there is no such thing as building with current environment settings. Also other settings, eg SET DELETED or SET EXCLUSIVE always revert to defaults in the EXE, eg the default of a VFP installation in regard of SET EXCLUSIVE is ON, as the developer may rather often need exclusive access to dbfs to change them, while the Default for that setting is OFF in runtime/EXE.

ON ERROR defaults to the system error handling in an EXE, as long as you don't have ON ERROR in your main.prg. Do you perphaps have only set up the error handling in the command window? Do you have ON ERROR in your main.prg and is it also set as the main prg in the project manager? It needs to be bold in the project manager, otherwise it's not the prg starting and thus no error handling will be set. I doubt that stringly, as other start code then would also not run, but who knows, I just add this to get 110% certain.

Bye, Olaf.
0
 
LVL 27

Expert Comment

by:CaptainCyril
ID: 36522597
You can also have the ERROR handler written in a library prg.

SET PROCEDURE TO library.prg && example

But it's best to have it in the main.prg as mentioned above.

If nothing is happening, then your program is calling a routine which is resetting the error trapping. That happens when you can certain third party scripts written in FoxPro. There was a problem in some wizards back in FPW26 and VFP6.
0
 

Author Closing Comment

by:luciliacoelho
ID: 36526252
Actually The main program name was inherited from another project and when I built the executable the main program activated was different from the one where the On Error Clause was activated.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
Is your company's data protection keeping pace with virtualization? Here are 7 dynamic ways to adapt to rapid breakthroughs in technology.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now