Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

On Error issue within project

Posted on 2011-09-12
4
Medium Priority
?
343 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 43

Accepted Solution

by:
pcelba earned 2000 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 30

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
Read on to get a few ideas on how to promote your next corporate event.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

721 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