コード例 #1
0
ファイル: S3Exception.cs プロジェクト: stukalin/ImageResizer
        internal static S3Exception FromErrorResponse(XmlReader reader, WebException exception)
        {
            if (reader.IsEmptyElement)
            {
                throw new Exception("Expected a non-empty <Error> element.");
            }

            reader.ReadStartElement("Error");

            S3ErrorCode errorCode = S3ErrorCode.Unknown;
            string      message = null, bucketName = null, requestID = null, hostID = null;

            while (reader.Name != "Error")
            {
                switch (reader.Name)
                {
                case "Code":
                    errorCode = ParseCode(reader.ReadElementContentAsString());
                    break;

                case "Message":
                    message = reader.ReadElementContentAsString();
                    break;

                case "BucketName":
                    bucketName = reader.ReadElementContentAsString();
                    break;

                case "RequestID":
                    requestID = reader.ReadElementContentAsString();
                    break;

                case "HostID":
                    hostID = reader.ReadElementContentAsString();
                    break;

                default:
                    reader.Skip();
                    break;
                }
            }

            return(new S3Exception(errorCode, bucketName, message, exception)
            {
                RequestID = requestID,
                HostID = hostID
            });
        }
コード例 #2
0
ファイル: S3Exception.cs プロジェクト: eakova/resizer
 public S3Exception(S3ErrorCode errorCode, string bucketName, string message, WebException innerException)
     : base(message, innerException)
 {
     this.ErrorCode = errorCode;
     this.BucketName = bucketName;
 }
コード例 #3
0
ファイル: S3Exception.cs プロジェクト: stukalin/ImageResizer
 public S3Exception(S3ErrorCode errorCode, string bucketName, string message, WebException innerException)
     : base(message, innerException)
 {
     this.ErrorCode  = errorCode;
     this.BucketName = bucketName;
 }