【问题标题】:.net AWS SDK - exception handling with SES.BeginSendEmail.net AWS SDK - 使用 SES.BeginSendEmail 处理异常
【发布时间】:2012-10-25 02:02:05
【问题描述】:

谁能告诉我在使用 .NET SDK for AWS SES 时如何处理异常?

返回的 IAsyncResult 的实现有异常,但它是内部的。

是否有其他方法可以访问它,或者我需要反映它:(

amazonSimpleEmailServiceClient.BeginSendEmail(sendEmailRequest, ar => {
    var result = ar as AsyncResult;
    // result has .Exception, but its internal :(
}, null);

谢谢

【问题讨论】:

    标签: amazon-web-services amazon-ses


    【解决方案1】:

    .NET AWS 开发工具包(以及整个 .NET,如在here 中详细讨论)中的 Begin*/End* 方法的标准方法是调用相应的 End* 方法。

    amazonSimpleEmailServiceClient.BeginSendEmail(sendEmailRequest, ar =>
    {
        try
        {
            amazonSimpleEmailServiceClient.EndSendEmail(ar);
        }
        catch (Exception e)
        {
            Console.WriteLine(e);
        }
    }, null);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-08
      • 1970-01-01
      相关资源
      最近更新 更多