void AddError(Error error, List <Error> errorList) { if (ThrowExceptionIfNotValid) { throw SDMXValidationException.Create(new List <Error> { error }, error.Message); } else { errorList.Add(error); } }
/// <summary> /// Writes the record in the form of string, object dictionary. /// </summary> /// <param name="record">The record to write.</param> public void WriteRecord(Dictionary <string, object> record) { CheckDisposed(); Dictionary <string, string> values = null; var errors = _validator.ValidateRecord(record, out values); if (errors.Count > 0) { throw SDMXValidationException.Create(errors, string.Format("Invalid record: {0}. See Errors property for details:", RecordToString(record))); } WriteRecord(values); }
public static SDMXValidationException Create(IEnumerable<Error> errors, string message) { var builder = new StringBuilder(); builder.AppendLine(message); foreach (var error in errors) { builder.AppendLine(error.Message); } var ex = new SDMXValidationException(builder.ToString()); ex.Errors = errors; return ex; }
public static SDMXValidationException Create(IEnumerable <Error> errors, string message) { var builder = new StringBuilder(); builder.AppendLine(message); foreach (var error in errors) { builder.AppendLine(error.Message); } var ex = new SDMXValidationException(builder.ToString()); ex.Errors = errors; return(ex); }