Christopher Kennedy
Member
Hi this is a question about error handling (exception handling) for a login prompt.
Environment Description:
Borland C++ Builder 6.0 (Build 10.166)
Windows 2000 (SP4)
Direct Oracle Access 4.0.5.0
Oracle8i Enterprise Edition Release 8.1.7.4.0
The problem I am having is trying to catch the exceptions that are thrown by the statement frmMain->OracleLogonSessionMain->Execute().
I want to override the default messages that appear such as "ORA-01005: null password given; logon denied". I have tried placing a try-catch block around the line mentioned above to no avail (I suspect the exception is thrown and caught inside the Execute() function).
Any tips on how to handle this issue as well as design improvements to my logon loop-if structure would be greatly appreciated (right now I have it set up so that the user will have infinite logon attempts until they are successful or click 'Cancel' / 'X').
Thank you,
Christopher Kennedy
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->CreateForm(__classid(TfrmMain), &frmMain);
while (!frmMain->OracleSessionMain->Connected)
{
// TRY-CATCH BLOCK AROUND THE FOLLOWING LINE?????
// TOracleLogon->Execute() returns false if 'Cancel' or 'X' is pressed
bool cancel = !frmMain->OracleLogonSessionMain->Execute();
if (cancel)
{
return 0;
}
}
Application->Run();
}
catch (Exception &exception)
{
// HAS YET TO EXECUTE WITH ALL THE TEST CASES I HAVE RUN
Application->ShowException(&exception);
}
return 0;
}
Environment Description:
Borland C++ Builder 6.0 (Build 10.166)
Windows 2000 (SP4)
Direct Oracle Access 4.0.5.0
Oracle8i Enterprise Edition Release 8.1.7.4.0
The problem I am having is trying to catch the exceptions that are thrown by the statement frmMain->OracleLogonSessionMain->Execute().
I want to override the default messages that appear such as "ORA-01005: null password given; logon denied". I have tried placing a try-catch block around the line mentioned above to no avail (I suspect the exception is thrown and caught inside the Execute() function).
Any tips on how to handle this issue as well as design improvements to my logon loop-if structure would be greatly appreciated (right now I have it set up so that the user will have infinite logon attempts until they are successful or click 'Cancel' / 'X').
Thank you,
Christopher Kennedy
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
Application->Initialize();
Application->CreateForm(__classid(TfrmMain), &frmMain);
while (!frmMain->OracleSessionMain->Connected)
{
// TRY-CATCH BLOCK AROUND THE FOLLOWING LINE?????
// TOracleLogon->Execute() returns false if 'Cancel' or 'X' is pressed
bool cancel = !frmMain->OracleLogonSessionMain->Execute();
if (cancel)
{
return 0;
}
}
Application->Run();
}
catch (Exception &exception)
{
// HAS YET TO EXECUTE WITH ALL THE TEST CASES I HAVE RUN
Application->ShowException(&exception);
}
return 0;
}