Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
ON ERROR DO errhand WITH ;
ERROR(), ;
MESSAGE(), ;
MESSAGE(1), ;
LINENO()
*............. ERR.PRG ................*
*!*****************************************************************************
*!
*! Procedure: errhand
*!
*!*****************************************************************************
PROCEDURE errhand
PARAMETER merror, MESS, mess1, mlineno
IF merror = 43 .OR. merror = 1405
DO nomem
ENDIF ( merror = 43 .OR. merror = 1405 )
IF TYPE("s_username") = "U"
STORE GETENV("USERNAME") TO s_username
ENDIF
STORE DTOC(DATE()) TO datestr
STORE TIME() TO timestr
IF TYPE("cfgdatapath" ) # "U"
STORE ALLTRIM(cfgdatapath) + SYS(3) TO errfile
ELSE
STORE SYS(3) TO errfile
ENDIF ( TYPE("cfgdatapath" ) # "U" )
*... This section saves the screen to a screen file
STORE errfile + '.erc' TO sdump
SAVE SCREEN TO mScrnDump
SAVE ALL LIKE mScrnDump TO (sdump)
STORE errfile + '.err' TO prgdump
x=FCREATE(prgdump)
IF x < 0
DO caution WITH ;
"FATAL ERROR | Retval: "+ ALLTRIM(STR(x)) ,;
"Unable to open error log file: {"+ prgdump + "}"
set sysmenu to default
ON ERROR
CANCEL
ELSE
=FPUTS(x, '------' + datestr + ' at ' + timestr + " File: " + errfile + '------')
=FPUTS(x, 'Username...................: ' + m.s_username)
=FPUTS(x, 'Error number...............: ' + LTRIM(STR(merror)))
=FPUTS(x, 'Error message..............: ' + MESS)
=FPUTS(x, 'Error message parameter....: ' + SYS(2018))
=FPUTS(x, 'Line of code with error....: ' + mess1)
=FPUTS(x, 'Line number of error.......: ' + LTRIM(STR(mlineno)))
STORE 1 TO prgcountr
STORE 'DAVE' TO theprg
DO WHILE ALLTRIM(theprg) # '
theprg = PROGRAM(prgcountr)
=FPUTS(x, 'Program level ' + LTRIM(STR(prgcountr)) + ')...........: ' + theprg)
prgcountr = prgcountr + 1
ENDDO ( ALLTRIM(theprg) # ' )
=FPUTS(x, 'User allocated memory......: ' + SYS(1016))
=FPUTS(x, 'Selected DBF...............: ' + DBF())
=FPUTS(x, 'Current lock status........: ' + SYS(2011))
=FPUTS(x, 'Controlling index number...: ' + SYS(21))
=FPUTS(x, 'Controlling index name.....: ' + SYS(22))
=FPUTS(x, '-------------------------------------------------------------------')
=FCLOSE(x)
ENDIF ( x < 0 )
LIST MEMO TO errfile+'.erm' NOCONSOLE
LIST STATUS TO errfile+'.ers' NOCONSOLE
DEFINE WINDOW err;
FROM 0.000, 0.000 ;
TO 12, 80 ;
TITLE "*** Internal Error ***" ;
FONT "FoxFont", 8 ;
FLOAT ;
CLOSE ;
nominimize ;
SYSTEM ;
COLOR RGB(,,,255,0,0)
MOVE WINDOW err CENTER
ACTIVATE WINDOW err TOP
@ 1, 1 SAY "A system error has occurred." ;
FONT "System", 9 COLOR RGB(255,255,0,255,0,0)
@ 2.5, 1 SAY "Please inform programming staff." ;
FONT "System", 9 COLOR RGB(255,255,0,255,0,0)
@ 4, 1 SAY "You may try 'Retry', but if errors" ;
FONT "System", 9 COLOR RGB(255,255,0,255,0,0)
@ 5.5, 1 SAY "persist, press 'Cancel'." ;
FONT "System", 9 COLOR RGB(255,255,0,255,0,0)
STORE ' TO booboo
@ 9.5, 20 GET booboo FUNCTION '*HT \<Retry;\<Cancel' ;
SIZE 1.5, 10, 0.667 ;
FONT "MS Sans Serif", 8 ;
STYLE "B"
READ CYCLE
RELEASE WINDOW err
ON ERROR DO errhand WITH ;
ERROR(), ;
MESSAGE(), ;
MESSAGE(1), ;
LINENO()
IF booboo = 'Retry'
RETURN
ELSE
ON ERROR
POP MENU _msysmenu
CANCEL
ENDIF ( booboo = 'Retry' )
RETURN
*!*****************************************************************************
*!
*! Procedure: NoMem
*!
*!*****************************************************************************
PROCEDURE nomem
DEFINE WINDOW nomem ;
AT 0.000, 0.000 ;
SIZE 10.071,74.200 ;
TITLE "* Out of Memory *" ;
FONT "Arial", 8 ;
STYLE "B" ;
FLOAT ;
NOCLOSE ;
MINIMIZE ;
SYSTEM ;
COLOR RGB(,,,255,0,0)
MOVE WINDOW nomem CENTER
IF WVISIBLE("nomem")
ACTIVATE WINDOW nomem SAME
ELSE
ACTIVATE WINDOW nomem NOSHOW
ENDIF ( WVISIBLE("nomem") )
@ 7.071,31.600 GET nomem ;
PICTURE "@*HT \<Ok" ;
SIZE 1.769,9.167,0.667 ;
DEFAULT 1 ;
FONT "MS Sans Serif", 8 ;
STYLE "B"
@ 2.286,9.400 SAY "There is not enough memory to perform function," ;
FONT "Arial", 8 ;
STYLE "BT"
@ 3.429,7.400 SAY "close some other Windows applications and try again." ;
FONT "Arial", 8 ;
STYLE "BT"
IF NOT WVISIBLE("nomem")
ACTIVATE WINDOW nomem
ENDIF ( NOT WVISIBLE("nomem") )
READ CYCLE
RELEASE WINDOW nomem
RETURN
*!*****************************************************************************
*!
*! Procedure: CAUTION
*!
*!*****************************************************************************
PROCEDURE caution
PARAMETERS cautitle, msgstring
IF NOT WEXIST("caution")
DEFINE WINDOW caution ;
AT 19.167, 15.000 ;
SIZE 7.308,95.000 ;
TITLE '*** ' + cautitle + ' ***';
FONT "MS Sans Serif", 8 ;
FLOAT ;
NOCLOSE ;
MINIMIZE ;
SYSTEM ;
COLOR RGB(,,,255,0,0)
ENDIF ( NOT WEXIST("caution") )
MOVE WINDOW caution CENTER
IF WVISIBLE("caution")
ACTIVATE WINDOW caution SAME
ELSE
ACTIVATE WINDOW caution NOSHOW
ENDIF ( WVISIBLE("caution") )
STORE WCOLS("caution")/2 TO wincenter
STORE LEN(msgstring)/2 TO mcenter
STORE 0 TO nothing
@1, (wincenter - mcenter) - 2 SAY msgstring;
COLOR RGB(0,0,0,255,255,0);
FONT "MS Sans Serif", 9 ;
STYLE "B"
@ 2.769, (wincenter - 4.3) GET nothing ;
PICTURE "@*HT \<Ok" ;
SIZE 1.769,8.667,0.667 ;
FONT "MS Sans Serif", 8 ;
STYLE "B"
READ CYCLE
CLEAR
DEACTIVATE WINDOW caution
RELEASE WINDOW caution
RETURN
*............. EOF: ERR.PRG ................*