I have a Delphi ActiveX project with 4 interfaces. Two of them have AutoComObject factories for their CoClasses. All the methods of the interfaces are declared with safecalls. In the interfaces with the factories, if a exception is thrown in any method, the caller receives an EOleException with the exception message from the original exception in the activex. But in the other two interfaces any exception gets masked as EOleException with the message masked to "Catastrophic Failure".
Anyone knows why this is happening, and how to make the original exception message not get masked?
If an unhandled exception escapes a safecall
method of a class, TObject.SafeCallException()
is called to convert the exception into an HRESULT
error code, which is then returned by COM to the caller. By default, TObject.SafeCallException()
always returns E_UNEXPECTED
($8000FFFF
). A class can override SafeCallException()
to return a more meaningful HRESULT
. TComObject
and TAutoIntfObject
do exactly that, for instance (they also call SetErrorInfo()
to set detailed information about the exception, which the caller can retrieve using GetErrorInfo()
if desired). So it sounds like your two AutoComObject
-based objects have a SafeCallException()
implementation, and your other two objects do not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With