FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Errors - Collecting Data
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Errors - Collecting Data
Posted: 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)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Errors - Collecting Data
Posted: Wed Aug 14, 2013 03:53 AM
Please include these lines at the beginning of the program in the Main() function

Code (fw): Select all Collapse
bFwErr  := ErrorBlock()
ErrorBlock( { |e| MyErrFunc( e, bFwErr ) } )


Declare a public function anywhere in your project

Code (fw): Select all Collapse
function MyErrFunc( oErr, bFwErr )

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



G. N. Rao.

Hyderabad, India
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Errors - Collecting Data
Posted: 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)
Posts: 166
Joined: Wed Aug 29, 2012 08:25 AM
Re: Errors - Collecting Data
Posted: Fri Aug 16, 2013 02:27 PM
Look in errorsysw.prg ,
Code (fw): Select all Collapse
   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

Continue the discussion