Ejemplo n.º 1
0
        /// <summary>
        /// Handles the exception from Google Cloud Storage servers when uploading
        /// operations.
        /// </summary>
        /// <param name="errorHandler">The error handler.</param>
        /// <param name="logEntry">The log entry.</param>
        /// <param name="e">The web exception that was thrown by the server.</param>
        private void HandleCloudException(BulkJobErrorHandler errorHandler, LogEntry logEntry,
                                          WebException e)
        {
            string    contents          = "";
            Exception downloadException = null;

            using (WebResponse response = e.Response) {
                try {
                    contents = MediaUtilities.GetStreamContentsAsString(
                        response.GetResponseStream());
                } catch {
                    contents = e.Message;
                }

                logEntry.LogResponse(response, true, contents);
                logEntry.Flush();

                downloadException = ParseException(e, contents);
            }
            if (errorHandler.ShouldRetry(downloadException))
            {
                errorHandler.PrepareForRetry(downloadException);
            }
            else
            {
                throw downloadException;
            }
            return;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles the exception from Google Cloud Storage servers when uploading
        /// operations.
        /// </summary>
        /// <param name="errorHandler">The error handler.</param>
        /// <param name="logEntry">The log entry.</param>
        /// <param name="e">The web exception that was thrown by the server.</param>
        /// <returns>True if this is a success, false if this was a server error.
        /// </returns>
        private void HandleCloudException(BulkJobErrorHandler errorHandler, LogEntry logEntry,
                                          WebException e)
        {
            Exception downloadException = null;

            using (WebResponse response = e.Response) {
                string contents = HttpUtilities.GetErrorResponseBody(e);

                logEntry.LogResponse(response, false, contents);
                logEntry.Flush();

                downloadException = ParseException(e, contents);

                if (errorHandler.ShouldRetry(downloadException))
                {
                    errorHandler.PrepareForRetry(downloadException);
                }
                else
                {
                    throw downloadException;
                }
            }
        }
        /// <summary>
        /// Handles the exception from Google Cloud Storage servers when uploading
        /// operations.
        /// </summary>
        /// <param name="errorHandler">The error handler.</param>
        /// <param name="logEntry">The log entry.</param>
        /// <param name="e">The web exception that was thrown by the server.</param>
        /// <returns>True if this is a success, false if this was a server error.
        /// </returns>
        private void HandleCloudException(BulkJobErrorHandler errorHandler, LogEntry logEntry,
        WebException e)
        {
            Exception downloadException = null;

              using (WebResponse response = e.Response) {
            string contents = HttpUtilities.GetErrorResponseBody(e);

            logEntry.LogResponse(response, false, contents);
            logEntry.Flush();

            downloadException = ParseException(e, contents);

            if (errorHandler.ShouldRetry(downloadException)) {
              errorHandler.PrepareForRetry(downloadException);
            } else {
              throw downloadException;
            }
              }
        }