Example #1
0
 private void populateFromXML(string xml)
 {
     try
     {
         MwsXmlReader    r      = new MwsXmlReader(xml);
         XmlMwsException parsed = r.Read <XmlMwsException>("Error");
         if (parsed.ErrorType != null)
         {
             this.errorType = parsed.ErrorType;
         }
         if (parsed.ErrorCode != null)
         {
             this.errorCode = parsed.ErrorCode;
         }
         if (parsed.Message != null)
         {
             this.message = parsed.Message;
         }
         if (parsed.Detail != null)
         {
             this.detail = parsed.Detail;
         }
     }
     catch (Exception)
     {
         // Just eat it
     }
 }
Example #2
0
        /// <summary>
        /// Initializes exception with information available from the service
        /// </summary>
        /// <param name="statusCode">HTTP status code for error response (as an int)</param>
        /// <param name="message">Error message from HTTP header</param>
        /// <param name="errorCode">Error code from response XML</param>
        /// <param name="errorType">Error type from response XML</param>
        /// <param name="xml">Compete XML found in response</param>
        /// <param name="rhmd">Response header information</param>
        public MwsException(int statusCode, string message, string errorCode, string errorType, string xml, MwsResponseHeaderMetadata rhmd)
            : base()
        {
            this.statusCode = statusCode;
            this.rhmd       = rhmd;
            this.xml        = xml;

            this.errorType = errorType;
            this.errorCode = errorCode;
            this.message   = message;

            if (xml != null)
            {
                try
                {
                    MwsXmlReader    r      = new MwsXmlReader(xml);
                    XmlMwsException parsed = r.Read <XmlMwsException>("Error");

                    this.errorType = parsed.ErrorType;
                    this.errorCode = parsed.ErrorCode;
                    this.message   = parsed.Message;
                    this.detail    = parsed.Detail;
                }
                catch (Exception)
                {
                    // Just eat it
                }
            }
        }