/// <summary>
        /// Return an instance of and ErrorResponseUnmarshaller.
        /// </summary>
        /// <returns></returns>
        public static S3ErrorResponseUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new S3ErrorResponseUnmarshaller();
            }

            return(instance);
        }
예제 #2
0
        public override bool Read()
        {
            //IL_004a: Unknown result type (might be due to invalid IL or missing references)
            bool result = this.Read();

            if (this.get_ResponseData().get_StatusCode() == HttpStatusCode.OK && !_checkedForErrorResponse && this.get_IsStartElement())
            {
                if (this.TestExpression("Error", 1))
                {
                    S3ErrorResponse s3ErrorResponse = new S3ErrorResponseUnmarshaller().Unmarshall(this);
                    throw new AmazonS3Exception(s3ErrorResponse.get_Message(), null, s3ErrorResponse.get_Type(), s3ErrorResponse.get_Code(), s3ErrorResponse.get_RequestId(), this.get_ResponseData().get_StatusCode(), s3ErrorResponse.Id2, s3ErrorResponse.AmzCfId)
                          {
                              Region = s3ErrorResponse.Region
                          };
                }
                _checkedForErrorResponse = true;
            }
            return(result);
        }
        public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
        {
            S3ErrorResponse errorResponse = S3ErrorResponseUnmarshaller.GetInstance().Unmarshall(context);

            return(new AmazonS3Exception(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode, errorResponse.Id2));
        }