Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
The best code for Error trapping?
Message
De
08/10/2004 11:01:22
Jon Neale
Bond International Software
Wootton Bassett, Royaume Uni
 
 
À
08/10/2004 10:43:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00949897
Message ID:
00949906
Vues:
13
I would get the Program(), lineno() and probably try and get the call stack as well. This is will provide you with pretty much all the information you need.

Typically this is what I return.

"Error " + ALLTRIM(STR(ERROR())) + CHR(13)+ ;
"Message() " + ALLTRIM(MESSAGE()) + CHR(13) + ;
"Message(1) " + ALLTRIM(MESSAGE(1)) + CHR(13) + ;
"SYS(2018) " + ALLTRIM(SYS(2018)) + CHR(13) + ;
"Program " + ALLTRIM(UPPER(p_PROGRAM)) + CHR(13) + ;
"Line Number " + ALLTRIM(STR(p_LINENO)) + CHR(13)

And get the callstack by this;

FUNCTION callstack
PARAMETERS p_prog
PRIVATE w_prog, w_return, w_sub, w_cnt

w_return = ""

FOR w_sub = 2 TO 32
IF program(w_sub)==p_prog
EXIT
ENDIF
NEXT

FOR w_cnt = w_sub TO 2 STEP -1
IF w_return==""
w_return=PROGRAM(w_cnt)
ELSE
w_return = w_return + "," + PROGRAM(w_cnt)
ENDIF
NEXT

RETURN w_return

Hope this helps.

Jon
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform