Class FieldOverflowException

Namespace
Wolfgang.Etl.FixedWidth.Exceptions
Assembly
Wolfgang.Etl.FixedWidth.dll

The exception thrown when a value converter or header converter returns a string that is wider than the field width defined by Length. This indicates a programming error — the converter does not respect the FieldLength contract.

public sealed class FieldOverflowException : InvalidOperationException, ISerializable
Inheritance
FieldOverflowException
Implements
Inherited Members

Remarks

This exception is not thrown for data values in the file that are too wide for a target type — it is only thrown when a ValueConverter or HeaderConverter returns a string longer than FieldLength. To silently truncate instead of throwing, use Truncate or TruncateHeader.

Constructors

FieldOverflowException(string, string, int, int)

Initializes a new instance of FieldOverflowException with full context about the overflowing field.

public FieldOverflowException(string message, string propertyName, int fieldLength, int actualLength)

Parameters

message string

A message that describes the error.

propertyName string

The name of the property whose converted value overflowed.

fieldLength int

The maximum number of characters allowed for the field.

actualLength int

The actual length of the string returned by the converter.

Properties

ActualLength

The actual number of characters in the string returned by the converter.

public int ActualLength { get; }

Property Value

int

FieldLength

The maximum number of characters allowed for the field, as defined by Length.

public int FieldLength { get; }

Property Value

int

PropertyName

The name of the property whose converted value exceeded the defined field width.

public string PropertyName { get; }

Property Value

string