Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Errorhandler.prg does not exist
Message
 
À
25/08/1997 16:19:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00046661
Message ID:
00046833
Vues:
82
>>>>>>I occasionally get the preseding error in my .exe. The errorhandler works most of the time, but in certain instances, I get this error instead. Clicking ignore, or cancel does nothing but get the error off the screen, and then the entire program is useless as any actionproduces the message again. I have to ctrl+alt+del to exit the program.
>>>>>>the following is in my main file before the instantiation of the app object:
>>>>>>ON ERROR ErrorHandler(ERROR(),PROGRAM(),LINENO())
>>>>>>and the error handler is at the end of the main file:
>>>>>>
>>>>>>FUNCTION ErrorHandler(nError,cMethod,nLine)
>>>>>>LOCAL lcErrorMsg,lcCodeLineMsg
>>>>>>
>>>>>>WAIT CLEAR
>>>>>>lcErrorMsg=MESSAGE()+CHR(13)+CHR(13)
>>>>>>lcErrorMsg=lcErrorMsg+"Method: "+cMethod
>>>>>>lcCodeLineMsg=MESSAGE(1)
>>>>>>IF BETWEEN(nLine,1,10000) AND NOT lcCodeLineMsg="..."
>>>>>> lcErrorMsg=lcErrorMsg+CHR(13)+"Line: "+ALLTRIM(STR(nLine))
>>>>>> IF NOT EMPTY(lcCodeLineMsg)
>>>>>> lcErrorMsg=lcErrorMsg+CHR(13)+CHR(13)+lcCodeLineMsg
>>>>>> ENDIF
>>>>>>ENDIF
>>>>>>IF MESSAGEBOX(lcErrorMsg,17,_screen.Caption)#1
>>>>>> ON ERROR
>>>>>> RETURN .F.
>>>>>>ENDIF
>>>>>>ENDFUNC
>>>>>>
>>>>>>The handler works fine until the program seems to 'lose' the location of the function. An additional hint, I get this message whenever there is an error with Foxfire! inside my program. This is not the only time however. An inescapable loop is pretty frustrating fot the user, and it is embarrasing to have to tell them to ctrl-alt-del to shut down my program. What am I doing wrong with the errorhandling?
>>>>>>
>>>>>>TIA
>>>>>
>>>>>Maybe in your clean-up code from FoxFire! you could explicitly set the error handler back you yours, i.e. ON ERROR ErrorHandler(ERROR(),PROGRAM(),LINENO()). Do this AFTER FoxFire! has completed all other processing and control has been returned to your calling program.
>>>>>
>>>>>HTH
>>>>
>>>>You could also remove the function from your main program and create a prg called: ERORHNDL.PRG (I use 8.3 in case it gets used in an 8.3 limited file server) Put ERORHNDL.PRG in your main app directory.
>>>>
>>>>...shot in the dark....
>>>
>>>Valerie- I don't think that this would get me anywhere because when an error occurs in Foxfire! the processing never gets a chance to return to the cleanup... it's stuck in Foxfire!
>>>Matt I will try your suggestion, and it will probably solve the problem, but I really want to know what's going on with the way I have it set up. Why can't I handle my errors like all the other programmers? Waaahhhhh... :-)
>>>
>>>Thanks for the help guys.
>>>
>>>Erik
>>
>>FoxFire! has its own error handling routine unless you override it with yours. If you are overriding it, then I suspect that your main program is out of scope when Foxfire is running. If you are replacing FoxFire's error handler with yours, then you will deffinately have to make it a prg as Matt suggested.
>
>This is what seems to be happening, but I am not sure I see how my program can be out of scope. I mean, it is the calling program right? How does the main program lose scope?

Erik, I don't think the problem is the main program going out of scope, but of a procedure file going out of scope. Try re-setting your 'Set Procedure To....' when you return from FoxFire!. I've gotten the same error message for a function which was in the main program, and found someone else's code was overwriting my procedures.

HTH
Barbara
Barbara Paltiel, Paltiel Inc.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform