Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error Handling
Message
De
12/07/2004 11:27:42
 
 
À
12/07/2004 08:40:46
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00923262
Message ID:
00923362
Vues:
19
>Wondering if somebody could give me a basic code example of error handling. I have not done this in VFP 7 and I know that a certain line of code is giving me an error. Thanks!

Mike

Somewhere in your code, before you expect any errors, have a line like:
ON ERROR do sysErrMess WITH ;
   ERROR(), MESSAGE(), MESSAGE( 1), PROGRAM(), LINENO()
then the error routine is like:
* Program sysERRMESS
* Display Message Box dialog of the error details, given by params

#INCLUDE Standard.H
LPARAMETERS tcError, tcMess, tcMess1, tcProg, tnlineNo
LOCAL		lcLine1, lcLine2, lcLine3, lcLine4, lcLine5

Store "" To lcLine1, lcLine2, lcLine3, lcLine4, lcLine5

lcLine1	= 'Error number:          ' + ALLTRIM( STR( tcError)) + CHR(13)
lcLine2	= 'Message:               ' + ALLTRIM( tcMess)  + CHR(13)
lcLine3	= 'occurred at Line No:   ' + ALLTRIM( STR( tnlineNo)) + CHR(13)
lcLine4	= 'of Program:            ' + PROPER( ALLTRIM( tcProg)) + CHR(13)
lcLine5	= 'Line of Code:          ' + ALLTRIM( tcMess1)  + "." + CHR(13) + CHR(13)
lcLine6	= 'Please note down details and report error.'
= MESSAGEBOX( lcLine1 + lcLine2 + lcLine3 + lcLine4 + lcLine5 + lcLine6, MB_ICONSTOP, "System Program Error")
HTH

Terry
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform