Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ErrorHandle often gives 0 in the LINENO()
Message
From
05/05/2002 23:01:55
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Title:
ErrorHandle often gives 0 in the LINENO()
Miscellaneous
Thread ID:
00652952
Message ID:
00652952
Views:
58
Hi,

My VFP6 written application had the error handle below
to cater for any error in my program for ease of debugging
and testing

ON ERROR DO ERRORHANDLE WITH ERROR(), MESSAGE(), LINENO(), PROGRAM() < == in my main program


PROCEDURE ErrorHandle(pvErrorno, pvMessage, pvLineno, pvProgram)


LOCAL lPath, lFileHandle, lStr

lPath = SYS(5)+CURDIR()

IF FILE(lPath+'Error.log')
lFileHandle = FOPEN(lPath+'Error.log',2)
ELSE
lFileHandle = FCREATE(lPath+'Error.log')
ENDIF

FSEEK(lFileHandle,0,2)

lStr = 'Error on '+TTOC(DATETIME())
FPUTS(lFileHandle,lStr,LEN(lStr))

lStr = 'Program with Error '+pvProgram
FPUTS(lFileHandle,lStr,LEN(lStr))

lStr = 'Error No = '+ALLT(STR(pvErrorNo))
FPUTS(lFileHandle,lStr,LEN(lStr))

lStr = 'Error Message = '+pvMessage
FPUTS(lFileHandle,lStr,LEN(lStr))

lStr = 'Error Line = '+ALLT(STR(pvLineNo))
FPUTS(lFileHandle,lStr,LEN(lStr))

lStr = CHR(13)+CHR(10)
FPUTS(lFileHandle,lStr,LEN(lStr))

FCLOSE(lFileHandle)

ENDPROC


However, when my program encountered any error, the log file will
only capture my program function/procedure name, but the lineno
is always 0, what is wrong with my program coding. Please kindly
advise me as this problem is giving headache as I can't pinpoint
which line is giving me error.

Thank you
Best Regards
Virusim
Next
Reply
Map
View

Click here to load this message in the networking platform