Exemple #1
0
        public override void Validate()
        {
            switch (this.Response.StatusCode)
            {
            case System.Net.HttpStatusCode.OK:
                this.Result = XmlSerdeUtility.Deserialize <QueueListModel>(this.ResponseText);
                break;

            default:
                throw new UnknowException(this.Response);
            }
        }
        public override void Validate()
        {
            switch (this.Response.StatusCode)
            {
            case HttpStatusCode.OK:
                this.Result = XmlSerdeUtility.Deserialize <Model.QueueAttributeModel>(this.ResponseText);
                break;

            case HttpStatusCode.NotFound:
                throw new QueueNotExistException(this.ResponseText);

            default:
                throw new UnknowException(this.Response);
            }
        }
        public override void Validate()
        {
            switch (this.Response.StatusCode)
            {
            case HttpStatusCode.OK:
                this.Result = XmlSerdeUtility.Deserialize <BatchReceiveMessageModel>(this.ResponseText);
                break;

            case HttpStatusCode.NotFound:
            {
                var error = XmlSerdeUtility.Deserialize <MnsError>(this.ResponseText);
                throw error.Code == "QueueNotExist" ? (MnsException) new QueueNotExistException(error) : new MessageNotExistException(error);
            }

            default:
                throw new UnknowException(this.Response);
            }
        }
Exemple #4
0
        public override void Validate()
        {
            switch (this.Response.StatusCode)
            {
            case HttpStatusCode.NoContent:
                break;

            case HttpStatusCode.NotFound:
                throw new QueueNotExistException(this.ResponseText);

            case HttpStatusCode.BadRequest:
            {
                var error = XmlSerdeUtility.Deserialize <MnsError>(this.ResponseText);
                throw error.Code == "InvalidArgument" ? (MnsException) new InvalidArgumentException(error) : new ReceiptHandleErrorException(error);
            }

            default:
                throw new UnknowException(this.Response);
            }
        }
Exemple #5
0
        public override void Validate()
        {
            switch (this.Response.StatusCode)
            {
            case HttpStatusCode.Created:
                this.Result = this.Response.Headers.Location.ToString();
                break;

            case HttpStatusCode.Conflict:
                throw new QueueAlreadyExistException(this.ResponseText);

            case HttpStatusCode.BadRequest:
            {
                var error = XmlSerdeUtility.Deserialize <MnsError>(this.ResponseText);
                throw error.Code == "InvalidArgument" ? (MnsException) new InvalidArgumentException(error) : new QueueNumExceededLimitException(error);
            }

            default:
                throw new UnknowException(this.Response);
            }
        }
        public override void Validate()
        {
            switch (this.Response.StatusCode)
            {
            case HttpStatusCode.Created:
                this.Result = XmlSerdeUtility.Deserialize <BatchSendMessageApiResultModel>(this.ResponseText);
                break;

            case HttpStatusCode.NotFound:
                throw new QueueNotExistException(this.ResponseText);

            case HttpStatusCode.BadRequest:
            {
                var error = XmlSerdeUtility.Deserialize <MnsError>(this.ResponseText);
                throw error.Code == "MalformedXML" ? (MnsException) new MalformedXMLException(error) : new InvalidArgumentException(error);
            }

            default:
                throw new UnknowException(this.Response);
            }
        }
Exemple #7
0
        public override void Validate()
        {
            switch (this.Response.StatusCode)
            {
            case HttpStatusCode.OK:
                this.Result = XmlSerdeUtility.Deserialize <ChangeVisibilityModel>(this.ResponseText);
                break;

            case HttpStatusCode.NotFound:
            {
                var error = XmlSerdeUtility.Deserialize <MnsError>(this.ResponseText);
                throw error.Code == "QueueNotExist" ? (MnsException) new QueueNotExistException(error) : new MessageNotExistException(error);
            }

            case HttpStatusCode.BadRequest:
                throw new InvalidArgumentException(this.ResponseText);

            default:
                throw new UnknowException(this.Response);
            }
        }
Exemple #8
0
 public MnsException(string errorMessage)
 {
     this.Error = XmlSerdeUtility.Deserialize <MnsError>(errorMessage);
 }