main logo
Subject: Error manager - cErrMgr
Author: James Sayer
Posted: 2001/05/17 17:06:46
 
View Entire Thread
New Search


Greetings,

I have made some modifications to the error handling class that may be of interst to others.

(1) Create the table as a free table. Default tries to add the table to the current dbc. This is a problem when you use multiple DBCs as with security. LogError() line 27 may be changed to read:
CREATE TABLE (.cErrorLogFile) FREE

(2) Increase the size of cUser field to 33 or more. LogError() line 28.
Now you can capture the machine ID and userID using SYS(0).
In the method GetErrorInfo() the property .cUser is used, but by default is blank. I simply changed to read: [AERROR_USER] = SYS(0) &&.cUser

(3) Pat Adams wrote an error handler in FP25 that included a tree of program calls. I like that feature and added it to this error handler.
It works by creating a bunch of variables with number suffixes showing the program at that particular level. Here's what to modify:
In LogError() between lines 42 and 68 (roughly) add this code:
*/////////////////*
(42) IF USED( lcAlias)
LOCAL lcTree, lnTree
FOR lnTree = 1 TO 30
lcTree= "ProgTree_"+ALLTRIM( TRANSFORM( lnTree, " At Z 99"))
STORE sys( 16, lnTree) TO &lcTree
IF EMPTY( sys( 16, lnTree))
exit
ENDIF
ENDFOR
*////////////////*
After line 68 the error log record is inserted and all the memory variables are written to a file DO.T These new memvars will also be written and viewable in the memo field.
James Sayer
 
©2001 James Sayer
<-- Prior Message New Search Next Message -->