Add a function afther the errors has occured (SOLVED)

Add a function afther the errors has occured (SOLVED)

Postby Marc Venken » 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
Last edited by Marc Venken on Sun Sep 17, 2017 6:34 pm, edited 1 time in total.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1431
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Add a function afther the errors has occured

Postby nageswaragunupudi » Sun Sep 17, 2017 4: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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Add a function afther the errors has occured (SOLVED)

Postby Marc Venken » Sun Sep 17, 2017 6:38 pm

Afther some search...

I put this in the MAIN program

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

and the function :

Code: Select all  Expand view
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.04 with Harbour
User avatar
Marc Venken
 
Posts: 1431
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Add a function afther the errors has occured (SOLVED)

Postby nageswaragunupudi » Mon Sep 18, 2017 3:10 am

From FWH17.08, it is possible to replace default error dialog with your own dialog without modifying errsysw.prg

Code: Select all  Expand view

SetErrorDialog( bOwnDialg ) --> bPrevious
 


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

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 84 guests