std/toml/error
std/toml/src/error.trb
TomlError: what went wrong reading or writing TOML - text that is not TOML, a document that does not fit the type it
is decoded into, or a value that TOML cannot say.
type TomlError
type TomlError with Show, Error
What went wrong turning TOML text into a tree or a value, or a value into TOML text.
Examples
use Toml from "std/toml"
match Toml().parse("port = 80 81") {
Ok(_) => print "read"
Fail(problem) => print "line {problem.line()}, column {problem.column()}: {problem.message()}"
}
fn syntax
static fn syntax(line: Int, column: Int, message: String): Self
The text is not TOML: line and column count from 1.
fn decodeFailed
static fn decodeFailed(cause: DecodeError, line: Int = 0): Self
The document is TOML, and Decode rejected it at line, or at no line in particular where that is 0.
fn unwritable
static fn unwritable(message: String): Self
The value cannot be written as TOML: TOML has no null, and its document is a table.
fn isSyntaxError
fn isSyntaxError(): Bool
true for text that is not TOML, as opposed to a document that did not fit its type.
fn line
fn line(): Int
The line the problem was found on, counted from 1, and 0 where it belongs to no line.
fn column
fn column(): Int
The column of the problem in its line, counted from 1 in characters, and 0 where it belongs to none.
fn message
fn message(): String
What is wrong, without the place.
fn show
fn show(): String
line 3, column 5: message for a syntax error, line 3: cause for a decode failure that has a line, and the bare
text for the rest.
fn cause
fn cause(): Error?
The DecodeError a document failed on, so a report can unwind the chain down to the field.