如何从InnerException获取DirectoryServicesCOMException ExtendedErrorMessage? 程序只捕获“catch(例外e)”,所以这不起作用:
try
{
...
}
catch (DirectoryServicesCOMException e)
{
throw e;
}
类似的东西:
try
{
...
}
catch (Exception e)
{
throw e.InnerException.DirectoryServicesCOMException ....;
}
答案 0 :(得分:0)
你应该可以这样做:
if (e.InnerException is DirectoryServicesCOMException)
{
DirectoryServicesCOMException innerException = (DirectoryServicesCOMException)e.InnerException;
// do whatever is correct with these kind of exception
}