Why cant I catch exception?

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
mikrodidakt
Posts: 20
Joined: Fri 05 Aug 2005 12:20
Location: Sweden

Why cant I catch exception?

Post by mikrodidakt » Tue 03 Apr 2007 15:31

try
{
database->MyScript->Execute();
}
catch (EMyError &e)
{
ShowMessage("cuaght exception");
}

the database is a borland module class that I have created to place all the components in and the MySQLScript is a TMySQLScript class. In the debugg mode I can se that my application is throwing a exception class EMySqlException but if I try to us that exception class i get a compiler error "missing catch statment".
The MyDAC version is old the version is 4.00.0.2 and uppgrade is not a option right now.

I can't even catch the exception if i use catch(...) and that should catch
every exception that is thrown in the try catch statment, right?

when I run this code the ShowMessage is never executed but another window popup with the error "#42000ALTER command denied to user 'mandoadmin'@'localhost' for table 'results'".
It's like the exception is caught by something else before it can be caught
by my catch statment what is it that I am doing wrong?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Wed 04 Apr 2007 09:08

To catch exceptions raised by TMyScript when executing, you should add a handler to the OnError event of the TMyScript object.

Post Reply