Page 1 of 1

How to get the message from a firebird db-exception?

Posted: 14.05.2009, 15:50
by Ostfriese
If an exception from a firebird db is raised, Delphi raises an exception like
SQL Error: exception 1 NOT_ALLOWED Zugriff verweigert At trigger 'CHECKUSER' line: 7, col: 32. Error Code: -836. exception.
which is sometimes simply overloaded. Especialy if you only need the raw exception messag - in this case -
Zugriff verweigert
But I can't find any way to parse the delphi exception message for the db-exceptions message.

Does anyone have an idea for this problem?

Posted: 14.05.2009, 22:01
by seawolf
At the moment is not possible but take a look at the unit

..\src\dbc\ZdbcInterbase6Utils.pas

procedure CheckInterbase6Error

that line

raise EZSQLException.CreateWithCode(ErrorCode,
Format('SQL Error: %s. Error Code: %d. %s',
[ErrorMessage, ErrorCode, ErrorSqlMessage]) + SQL);

display exception, so changing it you can achieve that request