I'm trying to protocol exceptions in my app and want to include the whole query text, when the error is EMSError.
I can do following
Code: Select all
e: EMSError;
begin
  if e.Component is TMSQuery then ... TMSQuery(e.Component).sql.text ...
Code: Select all
  q: TMSQuery;
begin
  q := TMSQuery.Create;
  try
    ...
    q.execsql
  finally
    q.free;
  end;
I understand, that is has to be empty, as the component is already freed, when the global exception handler comes to action.
But - is there some way to extend the EMSError class to include the query text as a string attribute, so that also in such cases the global exception handler can get the text, even when the query is already destroyed?
Thanks for info,
Ludek.