Hey,我有一张银灯,与一个世界合作框架服务连接,我用像这样的活动来收集错误:
private void GetContainersCompleted(object sender, GetContainersCompletedEventArgs e)
{
if (e.Error != null)
{
// show some generic message
}
else
{
// process
}
}
How can I determine what kind of error it is? service is down, network is unavailable, etc.
增 编
<>Update:
我对联系和网络例外感兴趣,我最后指出:
private void GetContainersCompleted(object sender, GetContainersCompletedEventArgs e)
{
if (e.Error != null)
{
if (e.Error.InnerException is EndpointNotFoundException ||
e.Error.InnerException is CommunicationException ||
e.Error.InnerException is SecurityException)
{
// show connection error message
}
else
{
// show generic error message
}
}
else
{
// process
}
}
任何建议?
增 编