FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Add a function afther the errors has occured (SOLVED)
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Add a function afther the errors has occured (SOLVED)
Posted: Sun Sep 17, 2017 12:49 PM

Can I executed a function ather the program has created the error.log with the standard errsysw.prg ?

I would like to keep always the standard programs from FWH in every new build, but like now, it would become handy if I have the
possibility to save the error in a online oRs: database. (before or afther the log is created)

I have different soccer trainers that uses a member program online. So if a error occures, they must be online, and the error could be written to a online database.

On the other hand, if I must use the original errsysw.prg, then where to I best put my extra errorhandling function?

function MyExtraError()
// open database and fill with needed data
// proceed with error handling from FWH standard
return NIL

Marc Venken

Using: FWH 23.08 with Harbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Add a function afther the errors has occured
Posted: Sun Sep 17, 2017 04:59 PM

FWH provides the following functions for user customization.

  1. SetErrorPath( cErrorLogPath ) --> cOldPath
  2. SetErrorFileName( cErrorLogFileName ) --> cOldName
  3. SetPostErrorAction( bAction ) --> bOldAction
    bAction is evaluated with cErrFileName (with path) and oError as parameters
    This codeblock is executed after the ErrorDialog is closed.

In this PostErrorAction codeblock you can do anything you want, but make sure you do not create any more runtime errors.

Please read \fwh\source\function\errsysw.prg for better clarity.

Regards



G. N. Rao.

Hyderabad, India
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Add a function afther the errors has occured (SOLVED)
Posted: Sun Sep 17, 2017 06:38 PM
Afther some search...

I put this in the MAIN program

SetPostErrorAction( { |cErrorLogFileName, oError| MyErrorAction( cErrorLogFileName, oError ) } )

and the function :

Code (fw): Select all Collapse
function MyErrorAction( cErrorLogFileName, oError )
 
    cErrText := memoread( "error.log" )
    oCn:Insert( "errors", "datum,uur,user,error,errorlog", { date(),time(), setup_naam, oError:dEscription,cErrText } )
    msginfo("Foutmelding is opgenomen")

return NIL


Thanks.
Marc Venken

Using: FWH 23.08 with Harbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Add a function afther the errors has occured (SOLVED)
Posted: Mon Sep 18, 2017 03:10 AM
From FWH17.08, it is possible to replace default error dialog with your own dialog without modifying errsysw.prg

Code (fw): Select all Collapse
SetErrorDialog( bOwnDialg ) --> bPrevious


FWH instead of displaying the default error dialog will Eval( bOwnDlg, oError, aStack, cErrLogText, cErrLogFile )
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion