/// <summary> /// Factory method for creating response when there is error connection. /// </summary> public static AuthenticationResponse CreateConnectionFailureResponse( HttpException httpException) { Debug.Assert(httpException != null); AuthenticationResponse authenticationResponse = new AuthenticationResponse(); authenticationResponse.authenticationResult = AuthenticationResultKind.ConnectionFailure; authenticationResponse.httpException = httpException; return authenticationResponse; }
internal void HttpRequestFailure( HttpException httpException, string exceptionResponseString, UploadResult batchUploadResult) { Debug.Assert(batchUploadResult == UploadResult.Unauthorized || batchUploadResult == UploadResult.Forbidden || batchUploadResult == UploadResult.BadGateway || batchUploadResult == UploadResult.OtherException); try { GoogleEmailUploaderTrace.EnteringMethod( "GoogleEmailUploaderModel.HttpRequestFailure"); this.WriteCurrentStatistics(null); string headersString = string.Empty; if (httpException.Response != null) { headersString = httpException.Response.Headers; } GoogleEmailUploaderTrace.WriteLine( "Exception: {0}", httpException.Message); GoogleEmailUploaderTrace.WriteLine("Response Headers: {0}", headersString); GoogleEmailUploaderTrace.WriteLine("Response message: {0}", exceptionResponseString); if (batchUploadResult != UploadResult.Unauthorized && batchUploadResult != UploadResult.Forbidden && batchUploadResult != UploadResult.Conflict) { this.TimedPauseUpload(PauseReason.ConnectionFailures); this.RaisePauseTime(); } } finally { GoogleEmailUploaderTrace.ExitingMethod( "GoogleEmailUploaderModel.HttpRequestFailure"); } }