Esempio n. 1
0
        internal ProcessingErrorEventArgs(RecordProcessingException exception)
        {
            this.Exception    = exception;
            this.RecordNumber = exception.RecordNumber;
            ColumnProcessingException columnException = exception.InnerException as ColumnProcessingException;

            if (columnException != null)
            {
                this.Schema           = columnException.Schema;
                this.ColumnDefinition = columnException.ColumnDefinition;
                this.ColumnValue      = columnException.ColumnValue;
            }
        }
Esempio n. 2
0
 private string FormatWithContext(IColumnContext columnContext, object value)
 {
     try
     {
         var definition = columnContext.ColumnDefinition;
         return(definition.Format(columnContext, value));
     }
     catch (Exception exception)
     {
         var columnException = new ColumnProcessingException(columnContext, value, exception);
         if (columnContext.RecordContext is IRecoverableRecordContext recordContext && recordContext.HasHandler)
         {
             var e = new ColumnErrorEventArgs(columnException);
             recordContext.ProcessError(this, e);
             if (e.IsHandled)
             {
                 return((string)e.Substitution);
             }
         }
         throw columnException;
     }
 }
Esempio n. 3
0
 private object ParseWithContext(IColumnContext columnContext, string rawValue)
 {
     try
     {
         var    definition  = columnContext.ColumnDefinition;
         object parsedValue = definition.Parse(columnContext, rawValue);
         return(parsedValue);
     }
     catch (Exception exception)
     {
         var columnException = new ColumnProcessingException(columnContext, rawValue, exception);
         if (columnContext.RecordContext is IRecoverableRecordContext recordContext && recordContext.HasHandler)
         {
             var e = new ColumnErrorEventArgs(columnException);
             recordContext.ProcessError(this, e);
             if (e.IsHandled)
             {
                 return(e.Substitution);
             }
         }
         throw columnException;
     }
 }
Esempio n. 4
0
 internal ColumnErrorEventArgs(ColumnProcessingException exception)
 {
     this.exception = exception;
 }