In our main application that launches other applications, we would like to trap -6301 (FORMS statement error number -6301) and -8063 (FORMS statement error number -8063) errors so we can insert an entry into a database table indicating that the user has logged out (though not intentionally). When the network connection drops over SSH using the GDC, we get this error quite frequently. Here is some sample code:
testdisconnect.4gl:
MAIN
CLOSE WINDOW SCREEN
DEFER INTERRUPT
CALL startlog("errlog")
OPEN WINDOW test_wind WITH FORM "testdisconnect"
try
CALL errorlog("Test writing to errlog -- Now see if it works with try/catch ")
MENU "MT"
ON ACTION cancel
EXIT MENU
ON ACTION close
EXIT MENU
END MENU
catch
CALL errorlog("It worked")
end try
CLOSE WINDOW test_wind
END MAIN
testdisconnect.per (ignore image):
DATABASE formonly
LAYOUT
GRID
{
[image1 ]
}
END
ATTRIBUTES
IMAGE image1:image1, IMAGE="test", PIXELWIDTH=640, PIXELHEIGHT=480,
STRETCH=BOTH;
To run my test, I run over VPN, then disconnect VPN. These are the results in the "errlog":
Date: 10/02/2017 Time: 07:00:52
Test writing to errlog -- Now see if it works with try/catch
Date: 10/02/2017 Time: 07:18:52
Program error at 'testdisconnect.4gl', line number 12.
FORMS statement error number -8063.
The client connection timed out, exiting program.
So it ignored the TRY/CATCH. I guess there is a question that it could get in an infinite loop if this is allowed, but whatever code we have in the CATCH/END TRY will be the final code for the 4gl program.
This would be a great feature to have.
Thanks,
Candy