public void TestCleanup() { try { if (_clientInformation.IsNotNull()) { WebServiceProxy.SpeciesObservationHarvestService.Logout(_clientInformation); } } catch { // Test is done. // We are not interested in problems that // occures due to test of error handling. } finally { _clientInformation = null; } }
/// <summary> /// Log exception. /// </summary> /// <param name="clientInformation">Information about the client that makes this web service call.</param> /// <param name="context">Web service request context.</param> /// <param name="exception">Log this exception.</param> private void LogException(WebClientInformation clientInformation, WebServiceContext context, Exception exception) { RequestTelemetry telemetry; try { if (clientInformation.IsNotNull() && (Configuration.InstallationType == InstallationType.Production)) { telemetry = OperationContext.Current.GetRequestTelemetry(); if (telemetry.IsNotNull()) { if (clientInformation.Locale.IsNotNull()) { telemetry.Properties[TelemetryProperty.LocaleId.ToString()] = clientInformation.Locale.Id.WebToString(); } if (clientInformation.Role.IsNotNull()) { telemetry.Properties[TelemetryProperty.RoleId.ToString()] = clientInformation.Role.Id.WebToString(); } if (context.IsNotNull()) { telemetry.Properties[TelemetryProperty.RequestId.ToString()] = context.RequestId.WebToString(); } } } if (context.IsNotNull()) { WebServiceData.LogManager.LogError(context, exception); } } catch (Exception) { // Do nothing. We are already in an exception handling sequence. } }