Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The best code for Error trapping?
Message
From
08/10/2004 11:01:22
Jon Neale
Bond International Software
Wootton Bassett, United Kingdom
 
 
To
08/10/2004 10:43:01
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00949897
Message ID:
00949906
Views:
12
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform