TomlException Class

Exception thrown when parsing or serializing TOML fails.

public sealed class TomlException : Exception
Inheritance
Exception TomlException

Constructors

NameDescription
TomlException()Initializes a new instance of the TomlException class.
TomlException(DiagnosticsBag)Initializes a new instance of the TomlException class.
TomlException(TomlSourceSpan, string)Initializes a new instance of the TomlException class with a specific source location.
TomlException(TomlSourceSpan, string, Exception?)Initializes a new instance of the TomlException class with a specific source location.
TomlException(string)Initializes a new instance of the TomlException class.
TomlException(string, Exception)Initializes a new instance of the TomlException class.

TomlException overloads

TomlException()

TomlException.cs

Initializes a new instance of the TomlException class.

public TomlException()

TomlException(DiagnosticsBag)

TomlException.cs

Initializes a new instance of the TomlException class.

public TomlException(DiagnosticsBag diagnostics)
Parameters
diagnostics DiagnosticsBag
The diagnostics that caused the exception.

TomlException(TomlSourceSpan, string)

TomlException.cs

Initializes a new instance of the TomlException class with a specific source location.

public TomlException(TomlSourceSpan span, string message)
Parameters
span TomlSourceSpan
message string

TomlException(TomlSourceSpan, string, Exception?)

TomlException.cs

Initializes a new instance of the TomlException class with a specific source location.

public TomlException(TomlSourceSpan span, string message, Exception? innerException)
Parameters
span TomlSourceSpan
message string
innerException Exception?

TomlException(string)

TomlException.cs

Initializes a new instance of the TomlException class.

public TomlException(string message)
Parameters
message string

TomlException(string, Exception)

TomlException.cs

Initializes a new instance of the TomlException class.

public TomlException(string message, Exception innerException)
Parameters
message string
innerException Exception

Properties

NameDescription
ColumnGets the 1-based column number associated with this exception, or null when unknown.
DiagnosticsGets the diagnostics associated with the exception.
LineGets the 1-based line number associated with this exception, or null when unknown.
MessageGets a message that describes the current exception.
OffsetGets the 0-based offset associated with this exception, or null when unknown.
SourceNameGets the optional source name associated with this exception (for example, a file path).
SpanGets the optional source span associated with this exception.

Gets the 1-based column number associated with this exception, or null when unknown.

public int? Column { get; }

Property value

int?

Diagnostics

TomlException.cs

Gets the diagnostics associated with the exception.

public DiagnosticsBag Diagnostics { get; }

Property value

DiagnosticsBag

Gets the 1-based line number associated with this exception, or null when unknown.

public int? Line { get; }

Property value

int?

Gets a message that describes the current exception.

public override string Message { get; }

Property value

string

Gets the 0-based offset associated with this exception, or null when unknown.

public int? Offset { get; }

Property value

int?

Remarks

This offset represents a character offset in the decoded TOML payload. When parsing UTF-8 inputs, the offset is computed after decoding.

Gets the optional source name associated with this exception (for example, a file path).

public string? SourceName { get; }

Property value

string?

Gets the optional source span associated with this exception.

public TomlSourceSpan? Span { get; }

Property value

TomlSourceSpan?