Solved

On Error issue within project

Posted on 2011-09-12
4
341 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 42

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
An introduction to the wonderful sport of Scam Baiting.  Learn how to help fight scammers by beating them at their own game. This great pass time helps the world, while providing an endless source of entertainment. Enjoy!
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.
Suggested Courses

752 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