EUpdateError exception not recognized when raised in TDatasetProvider.OnUpdateError. Why?
- by max
When I re-throw a EUpdateError exception in the TDatasetProvider.OnUpdateError event, it is not recognized as EUpdateError exception in the catch block. It's only recognized as base Excption.
try
...
//calls the TDatasetPorvider.OnUpdateError event.
myClientDataSet.ApplyUpdates(0);
...
except
on ex: EUpdateError do
begin
//never goes here
//Evaluate ex.ErrorCode
end;
on ex: Exception do
begin
//always goes here
//the expression (ex is EUpdateError) returns false;
end;
end;
Hiere is the corresponding .OnUpdateError implementaion:
procedure MyDataModule.MyDatasetProviderOnUpdateError(..;E: EUpdateError;...);
beign
//Here, the expression (E is EUpdateException) returns true;
raise E;
end;
The exception is re-thrown, but as it seems the EUpdateError is transformed into a plain base Execption.
Does anybody know, why the class type get lost? I would need that type in order to check the .ErrorCode to know what went wrong and to prepare the proper user message.