Class MalformedLineException

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

Base class for exceptions thrown when a line in a fixed-width file cannot be parsed.

public abstract class MalformedLineException : Exception, ISerializable
Inheritance
MalformedLineException
Implements
Derived
Inherited Members

Remarks

Two derived types cover the specific failure modes:

  • LineTooShortException — the line is shorter than the total width required to read all fields.
  • FieldConversionException — the line was long enough but a field's raw string value could not be converted to the target property type.

Catch MalformedLineException to handle both cases uniformly, or catch the derived types individually for finer-grained error handling.

Constructors

MalformedLineException(string, long, string)

Initializes a new instance of MalformedLineException with a descriptive message.

protected MalformedLineException(string message, long lineNumber, string lineContent)

Parameters

message string

A message that describes the error.

lineNumber long

The 1-based line number of the offending line.

lineContent string

The raw content of the offending line.

MalformedLineException(string, long, string, Exception)

Initializes a new instance of MalformedLineException with a descriptive message and an inner exception.

protected MalformedLineException(string message, long lineNumber, string lineContent, Exception innerException)

Parameters

message string

A message that describes the error.

lineNumber long

The 1-based line number of the offending line.

lineContent string

The raw content of the offending line.

innerException Exception

The exception that caused this exception.

Properties

LineContent

The raw string content of the offending line.

public string LineContent { get; }

Property Value

string

LineNumber

The 1-based line number of the offending line in the file.

public long LineNumber { get; }

Property Value

long