Server Reference Guide : 9. .NET Interface : Differences between .NET and Java Interfaces : Exception Mapping
 
Share this page                  
Exception Mapping
In the Java interface, all failure HRESULTs from the underlying COM interface are reported by throwing a com.ca.openroad.COMException containing that HRESULT value.
The .NET COM interoperability layer does something similar, using the System.Runtime.InteropServices.COMException class. However, it uses that exception class only as a last resort. If there is already a .NET exception class that reasonably represents the meaning of a particular HRESULT, the interoperability layer throws that .NET exception instead of a COMException. For example, HRESULT 0x80070005 “Access Denied” is reported as System.UnauthorizedAccessException.
Therefore, a single catch clause for COMException will not pick up all possible HRESULT failures.