コード例 #1
0
ファイル: DataReader.cs プロジェクト: tomplusit/sdmxdotnet
 void AddError(Error error, List <Error> errorList)
 {
     if (ThrowExceptionIfNotValid)
     {
         throw SDMXValidationException.Create(new List <Error> {
             error
         }, error.Message);
     }
     else
     {
         errorList.Add(error);
     }
 }
コード例 #2
0
ファイル: DataWriter.cs プロジェクト: tomplusit/sdmxdotnet
        /// <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);
        }
コード例 #3
0
        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;
        }
コード例 #4
0
        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);
        }