Наследование: System.Exception, ISerializable
            public void DryRun(AmazonEC2Client client, AmazonEC2Request request, ref DryRunResponse response)
            {
                response.IsSuccessful = false;

                SetDryRun(request, true);
                try
                {
                    Method.Invoke(client, new object[] { request });
                    // If no exception thrown, consider this a failure
                    response.Message = "Unrecognized service response for the dry-run request.";
                }
                catch (Exception invokeException)
                {
                    Exception actualException = invokeException.InnerException;
                    AmazonEC2Exception ec2e = actualException as AmazonEC2Exception;

                    response.Message = actualException.Message;
                    if (ec2e != null)
                    {
                        response.IsSuccessful = ec2e.StatusCode == HttpStatusCode.PreconditionFailed;
                        response.ResponseMetadata = new ResponseMetadata
                        {
                            RequestId = ec2e.RequestId
                        };
                    }

                    if (!response.IsSuccessful)
                        response.Error = actualException;
                }
                finally
                {
                    SetDryRun(request, false);
                }
            }
Пример #2
0
 /// <summary>
 /// Constructs AmazonEC2Exception with message and wrapped exception
 /// </summary>
 /// <param name="message">Overview of error</param>
 /// <param name="t">Wrapped exception</param>
 public AmazonEC2Exception(String message, Exception t) : base(message, t)
 {
     this.message = message;
     if (t is AmazonEC2Exception)
     {
         AmazonEC2Exception ex = (AmazonEC2Exception)t;
         this.statusCode = ex.StatusCode;
         this.errorCode  = ex.ErrorCode;
         this.errorType  = ex.ErrorType;
         this.requestId  = ex.RequestId;
         this.xml        = ex.XML;
     }
 }
Пример #3
0
        public AmazonEC2Exception(string message, Exception innerException) : base(message, innerException)
        {
            this.message = message;
            AmazonEC2Exception exception = innerException as AmazonEC2Exception;

            if (exception != null)
            {
                this.statusCode = exception.StatusCode;
                this.errorCode  = exception.ErrorCode;
                this.errorType  = exception.ErrorType;
                this.requestId  = exception.RequestId;
                this.xml        = exception.XML;
            }
        }