Errors - Collecting Data

Errors - Collecting Data

Postby Jeff Barnes » Tue Aug 13, 2013 10:11 pm

Hi All,

I posted this yesterday but it didn't show up in the list ... weird... Anyway:

Is there any way to call a user function either before or after errsysw is called ?

I want to be able to log certain vars used in my app but I would like to avoid having to modify errsysw.prg
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Errors - Collecting Data

Postby nageswaragunupudi » Wed Aug 14, 2013 3:53 am

Please include these lines at the beginning of the program in the Main() function

Code: Select all  Expand view
bFwErr  := ErrorBlock()
ErrorBlock( { |e| MyErrFunc( e, bFwErr ) } )
 


Declare a public function anywhere in your project

Code: Select all  Expand view
function MyErrFunc( oErr, bFwErr )

   // our special code
   
return Eval( bFwErr, oErr )
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Errors - Collecting Data

Postby Jeff Barnes » Wed Aug 14, 2013 12:28 pm

Excellent. Thanks. Works perfectly.

Another question....
Is it at all possible to generate a list of ALL vars currently used in memory and store them to a text file or does this have to be done manually ?

Something like:

cVar1 = "Some text"
nVar2 = 10
etc....

I know I've asked this before but I hoped that maybe someone has come up with a way to do it :oops:
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Errors - Collecting Data

Postby Franklin Demont » Fri Aug 16, 2013 2:27 pm

Look in errorsysw.prg ,
Code: Select all  Expand view

   cErrorLog += CRLF + "Variables in use" + CRLF + "================" + CRLF
   cErrorLog += "   Procedure     Type   Value" + CRLF
   cErrorLog += "   ==========================" + CRLF

   n := 2    // we don't disscard any info again !
   while ( n < 74 )

       if ! Empty( ProcName( n ) )
          cErrorLog += "   " + Trim( ProcName( n ) ) + CRLF
          for j = 1 to ParamCount( n )
             cErrorLog += "     Param " + Str( j, 3 ) + ":    " + ;
                          ValType( GetParam( n, j ) ) + ;
                          "    " + cGetInfo( GetParam( n, j ) ) + CRLF
          next
          for j = 1 to LocalCount( n )
             cErrorLog += "     Local " + Str( j, 3 ) + ":    " + ;
                          ValType( GetLocal( n, j ) ) + ;
                          "    " + cGetInfo( GetLocal( n, j ) ) + CRLF
          next
       endif

       n++
   end
 
test
Franklin Demont
 
Posts: 166
Joined: Wed Aug 29, 2012 8:25 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 76 guests