The problem arises when divided by zero or failed to block network access to the database or adding a record.
According to a source in the following cases: EG_ZERODIV, EG_OPEN, EG_APPENDLOCK.
It is important that these events NOT must be at GRID. They can occur anywhere in the program and then GRID will have blank rows, until you close a program.
It was reported on the forum: http://www.hmgforum.com/viewtopic.php?f ... =20#p43507
As he wrote Marek, you have to change ErrorSys.prg and rebuild hmg. Then rebuild own project.
You also do not change ErrorSys, You need add in your own project error handling.
At the beginning of the procedure MAIN:
Code: Select all
OrgErrorBlock := ErrorBlock( { | oError | FrancosError( oError ) } )
Code: Select all
****************************
FUNCTION FrancosError( oError )
LOCAL cMessage
LOCAL cDOSError
LOCAL n
Local Ai
Local lUsr:=.F.
//Html Arch to ErrorLog
LOCAL HtmArch, xText
MEMVAR _HMG_SYSDATA
#include "hmg.ch"
#include "error.ch"
#INCLUDE "COMMON.CH"
// By default, division by zero results in zero
IF oError:genCode == EG_ZERODIV
RETURN 0
ENDIF
// Set NetErr() of there was a database open error
IF oError:genCode == EG_OPEN .AND. ;
oError:osCode == 32 .AND. ;
oError:canDefault
NetErr( .T. )
RETURN .F.
ENDIF
// Set NetErr() if there was a lock error on dbAppend()
IF oError:genCode == EG_APPENDLOCK .AND. ;
oError:canDefault
NetErr( .T. )
RETURN .F.
ENDIF
// _HMG_SYSDATA [ 347 ] := .F. <-I think that this line is not needed at all
HtmArch := Html_ErrorLog()
cMessage := ErrorMessage( oError )
IF ! Empty( oError:osCode )
cDOSError := "(DOS Error " + LTRIM( STR( oError:osCode ) ) + ")"
ENDIF
IF ! Empty( oError:osCode )
cMessage += " " + cDOSError
ENDIF
Html_LineText(HtmArch, '<p class="updated">Date:' + Dtoc(Date()) + " " + "Time: " + Time() )
Html_LineText(HtmArch, cMessage + "</p>" )
n := 2
ai = cmessage + CHR(13) + CHR (10) + CHR(13) + CHR (10)
WHILE ! Empty( ProcName( n ) )
xText := "Called from " + ProcName( n ) + "(" + ALLTRIM( STR( ProcLine( n++ ) ) ) + ")" +CHR(13) +CHR(10)
ai = ai + xText
Html_LineText(HtmArch,xText)
ENDDO
Html_Line(HtmArch)
lUsr:=ShowError(ai, (oError:canRetry), (oError:canDefault))
*QUIT
RETURN lUsr
// [vszakats]
*******************************************
Function ShowError ( ErrorMesssage , lRetry, lDefault)
********************************************
Local nRetMsg, nMilliseconds := 30000 //30 sec
Local nTypeIconButton
#include "i_MsgBox.ch"
DO CASE
CASE !lRetry .AND. !lDefault
nTypeIconButton := MB_OK
CASE lRetry .AND. lDefault
nTypeIconButton := MB_ABORTRETRYIGNORE
CASE lRetry
nTypeIconButton := MB_RETRYCANCEL
OTHER
nTypeIconButton := MB_OK
ENDCASE
nTypeIconButton+=MB_ICONERROR + MB_SYSTEMMODAL
nRetMsg:=MessageBoxTimeout ( ErrorMesssage , 'Program Error ' , nTypeIconButton, nMilliseconds)
DO CASE
CASE nRetMsg=IDRETRY .OR. nRetMsg=IDTRYAGAIN
RETURN (.T.)
CASE nRetMsg=IDIGNORE
RETURN (.F.)
OTHER
// "Quit" selected
UnloadAllDll()
dbcloseall()
ExitProcess(0)
QUIT
ENDCASE
Return .F.
*************************************************************************************************
STATIC FUNCTION ErrorMessage( oError )
LOCAL cMessage
// start error message
cMessage := iif( oError:severity > ES_WARNING, "Error", "Warning" ) + " "
// add subsystem name if available
IF ISCHARACTER( oError:subsystem )
cMessage += oError:subsystem()
ELSE
cMessage += "???"
ENDIF
// add subsystem's error code if available
IF ISNUMBER( oError:subCode )
cMessage += "/" + LTRIM( STR( oError:subCode ) )
ELSE
cMessage += "/???"
ENDIF
// add error description if available
IF ISCHARACTER( oError:description )
cMessage += " " + oError:description
ENDIF
// add either filename or operation
DO CASE
CASE !Empty( oError:filename )
cMessage += ": " + oError:filename
CASE !Empty( oError:operation )
cMessage += ": " + oError:operation
ENDCASE
RETURN cMessage