Solved

On Error issue within project

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

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…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

810 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