Solved

On Error issue within project

Posted on 2011-09-12
4
336 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
A customer recently asked me about anti-malware and the different deployment options available for his business. Daily news about cyberattacks, zero-day vulnerabilities, and companies that suffered a security breach made him wonder if the endpoint a…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

910 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

16 Experts available now in Live!

Get 1:1 Help Now