/// <summary> /// Helper method for verifiers to report failure /// </summary> /// <param name="request">The request that failed verification</param> /// <param name="response">The response that failed verification</param> protected void ReportFailure(ODataRequest request, ODataResponse response) { ExceptionUtilities.CheckArgumentNotNull(request, "request"); ExceptionUtilities.CheckArgumentNotNull(response, "response"); if (this.OnReportingFailure != null) { this.OnReportingFailure(request, response); } this.Logger.WriteLine(LogLevel.Verbose, "Response verification failure"); request.WriteToLog(this.Logger, LogLevel.Verbose); response.WriteToLog(this.Logger, LogLevel.Verbose); }
private void ExecuteAndCatchErrors(ODataRequest request, ODataResponse response, Action action) { try { action(); } catch (Exception ex) { request.WriteToLog(this.Logger, LogLevel.Verbose); response.WriteToLog(this.Logger, LogLevel.Verbose); #if !SILVERLIGHT if (this.Synchronizer != null) { EntitySet entitySet; if (request.Uri.TryGetExpectedEntitySet(out entitySet)) { try { SyncHelpers.ExecuteActionAndWait(c => this.Synchronizer.SynchronizeEntireEntitySet(c, entitySet.Name)); } catch (Exception syncException) { this.Logger.WriteLine(LogLevel.Error, "Failed to synchronize set '{0}'", entitySet.Name); this.Logger.WriteLine(LogLevel.Error, syncException.ToString()); } } } #endif throw new AssertionFailedException("Failed to deserialize response body", ex); } }