【发布时间】:2014-11-04 14:47:33
【问题描述】:
我正在编写调用Windows.Networking.PushNotifications中存在的以下方法的代码
// Summary:
// Creates objects that you use to retrieve push notification channels from
// the Windows Push Notification Services (WNS). These channels are bound to
// an app or secondary tile.
[Threading(ThreadingModel.MTA)]
[Version(100794368)]
public static class PushNotificationChannelManager
{
// Summary:
// Creates an object, bound to the calling app, through which you retrieve a
// push notification channel from Windows Push Notification Services (WNS).
//
// Returns:
// The object, bound to the calling app, that is used to request a PushNotificationChannel
// from the Windows Push Notification Services (WNS).
[Overload("CreatePushNotificationChannelForApplicationAsync")]
public static IAsyncOperation<PushNotificationChannel> CreatePushNotificationChannelForApplicationAsync();
}
我想确保涵盖所有可能引发异常的情况并适当地处理每一种情况。我是否有可能获得一个列表,其中列出了这可能引发的不同类型的异常以及可能导致它们的不同情况?
我不想只包罗万象
catch(Exception ex) { }
This MSDN article 声明“如果在没有数据连接的情况下尝试注册 WNS 推送通知通道,则会引发异常”。但是它没有说明什么类型的异常或者是否有其他情况可以抛出异常。
如何确定是否存在其他可能的异常类型?
【问题讨论】:
-
你应该关心处理另一个代码抛出的异常吗?这是处理自定义异常的代码责任。你应该做的就是全部抓住。
-
另请参阅stackoverflow.com/questions/986180/… 了解有关同一主题的更多信息。
标签: c# .net exception exception-handling