Ejemplo n.º 1
0
        /// <summary>
        /// Ensure the request was successful.
        /// </summary>
        /// <param name="response">The <see cref="AmazonWebServiceResponse"/> to check.</param>
        /// <exception cref="AmazonSqsTransportException">If the request was not successful.</exception>
        public static void EnsureSuccess(this AmazonWebServiceResponse response)
        {
            if (response.Successful())
            {
                return;
            }
            const string documentationUri = "https://aws.amazon.com/blogs/developer/logging-with-the-aws-sdk-for-net/";

            var statusCode = response.HttpStatusCode;
            var requestId  = response.ResponseMetadata.RequestId;

            throw new AmazonSqsTransportException($"Received unsuccessful response ({statusCode}) from AWS endpoint.\n" +
                                                  $"See AWS SDK logs ({requestId}) for more details: {documentationUri}");
        }