Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
On error-lineno()
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00227975
Message ID:
00227993
Vues:
17
>>>>You need to pass the LINENO() in your on error call. As in:
>>>>
>>>>ON ERROR DO CatchErr WITH ERROR(), MESSAGE(), LINENO(), PROGRAM()
>>>>
>>>>>I am trying to catch errors using
>>>>>on error do catcherr where catcherr.prg contains:
>>>>>"str(ERROR( ))+MESSAGE( )+str(LINENO( ))+pROGRAM( )"
>>>>>
>>>>>but the lineno() reports back the lineno of catcherr, not where the error actually happens!
>>>
>>>Josh, I may not have conveyed too well but I did that.
>>
>>Timothy,
>>
>>Could you post some code from catcherr.prg. Basically, it should look something like this:
>>
>>ON ERROR DO CatchErr WITH ERROR(), MESSAGE(), LINENO(), PROGRAM()
>>
>>* CatchErr.prg
>>LPARAMETERS lnError, lcMessage, lnLineNo, lcProgram
>>?lnError, lcMessage, lnLineNo, lcProgram
>
>OK it's like this:
>on error do catcherr
>
>~~catcherr.prg~~~
>use errors excl
> appe blank
> repl problem with str(ERROR())+MESSAGE()+str(LINENO())+' '+pROGRAM()
>RETU
>
>lineno always comes back with 3.

Take a look at the sample I posted. You need to pass the ERROR(), LINENO(), etc. to catcherr from your ON ERROR call. Otherwise they'll be evaluated in catcherr and of course you'll get the line # in catcherr instead of the program that had the error.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform