public static void CheckErrorsFromReader(PipelineReader <object> reader, ThrowIcfExceptionDelegate throwIcfExceptionDelegate) { IList <ErrorRecord> errors = new List <ErrorRecord>(); while (true) { object error = reader.Read(); if (error == AutomationNull.Value) { break; } AddError(errors, error); } CheckErrors(errors, throwIcfExceptionDelegate); }
private static void CheckErrors(IList <ErrorRecord> errors, ThrowIcfExceptionDelegate throwIcfExceptionDelegate) { if (errors == null) { return; } Exception firstException = null; ErrorRecord firstErrorRecord = null; StringBuilder builder = new StringBuilder(); foreach (ErrorRecord error in errors) { if (error != null) { LOG.Error("ErrorRecord:\n - CategoryInfo: {0}\n - FullyQualifiedErrorId: {1}\n" + " - ErrorDetails: {2}\n - Exception: {3}\n - InvocationInfo: {4}\n - PipelineIterationInfo: {5}\n - TargetObject: {6}", error.CategoryInfo, error.FullyQualifiedErrorId, error.ErrorDetails, error.Exception, error.InvocationInfo, CollectionUtil.Dump(error.PipelineIterationInfo), error.TargetObject); var c = error.CategoryInfo; LOG.Error("CategoryInfo details:\n - Category: {0}\n - Activity: {1}\n" + " - Reason: {2}\n - TargetName: {3}\n - TargetType: {4}", c.Category, c.Activity, c.Reason, c.TargetName, c.TargetType); if (firstException == null && error.Exception != null) { firstException = error.Exception; } if (firstErrorRecord == null) { firstErrorRecord = error; } builder.Append(error.ToString()); builder.Append("\n"); } } if (firstException != null) { throwIcfExceptionDelegate(firstException, firstErrorRecord, builder.ToString()); } else if (builder.Length > 0) { throw new ConnectorException(builder.ToString()); } }
private static void CheckErrors(IList<ErrorRecord> errors, ThrowIcfExceptionDelegate throwIcfExceptionDelegate) { if (errors == null) { return; } Exception firstException = null; ErrorRecord firstErrorRecord = null; StringBuilder builder = new StringBuilder(); foreach (ErrorRecord error in errors) { if (error != null) { LOGGER.TraceEvent(TraceEventType.Error, CAT_DEFAULT, "ErrorRecord:\n - CategoryInfo: {0}\n - FullyQualifiedErrorId: {1}\n" + " - ErrorDetails: {2}\n - Exception: {3}\n - InvocationInfo: {4}\n - PipelineIterationInfo: {5}\n - TargetObject: {6}", error.CategoryInfo, error.FullyQualifiedErrorId, error.ErrorDetails, error.Exception, error.InvocationInfo, CollectionUtil.Dump(error.PipelineIterationInfo), error.TargetObject); var c = error.CategoryInfo; LOGGER.TraceEvent(TraceEventType.Information, CAT_DEFAULT, "CategoryInfo details:\n - Category: {0}\n - Activity: {1}\n" + " - Reason: {2}\n - TargetName: {3}\n - TargetType: {4}", c.Category, c.Activity, c.Reason, c.TargetName, c.TargetType); if (firstException == null && error.Exception != null) { firstException = error.Exception; } if (firstErrorRecord == null) { firstErrorRecord = error; } builder.Append(error.ToString()); builder.Append("\n"); } } if (firstException != null) { throwIcfExceptionDelegate(firstException, firstErrorRecord, builder.ToString()); } else if (builder.Length > 0) { throw new ConnectorException(builder.ToString()); } }
public static void CheckErrorsFromReader(PipelineReader<object> reader, ThrowIcfExceptionDelegate throwIcfExceptionDelegate) { IList<ErrorRecord> errors = new List<ErrorRecord>(); while (true) { object error = reader.Read(); if (error == AutomationNull.Value) { break; } AddError(errors, error); } CheckErrors(errors, throwIcfExceptionDelegate); }