public bool HandleError(Exception error) { ParametersInfo parametersInfo = OperationContext.Current.Extensions.Find <ParametersInfo>(); if (parametersInfo != null) { string errParams = parametersInfo.Parameters .Select(ErrorLoggingUtils .GetObjectAsXml).Aggregate((prev, next) => $"{prev}\n{next}"); string message = $"Exception of type {error.GetType().Name} occured: {error.Message}\n operation parameters are:\n{errParams}\n"; _traceSource.TraceEvent(TraceEventType.Error, 0, message); } return(true); }
public bool HandleError(Exception error) { ParametersInfo parametersInfo = OperationContext.Current.Extensions.Find <ParametersInfo>(); if (parametersInfo != null) { // Convert the parameters to strings and concatenate them to a string with new lines string message = string.Format ("Exception of type {0} occurred: {1}\n operation parameters are:\n{2}\n", error.GetType().Name, error.Message, parametersInfo.Parameters.Select (o => ErrorLoggingUtils.GetObjectAsXml(o)).Aggregate((prev, next) => prev + "\n" + next)); _traceSource.TraceEvent(TraceEventType.Error, 0, message); } return(true); }