toml::parse_error class

An error generated when parsing fails.

Public functions

auto description() const →  std::string_view noexcept
Returns a textual description of the error.
auto source() const →  const source_region& noexcept
Returns the region of the source document responsible for the error.

Friends

auto operator<<(std::ostream& lhs, const parse_error& rhs) →  std::ostream&
Prints a parse_error to a stream.

Function documentation

std::string_view toml::parse_error::description() const noexcept

Returns a textual description of the error.

std::ostream& operator<<(std::ostream& lhs, const parse_error& rhs)

Prints a parse_error to a stream.

Parameters
lhs The stream.
rhs The parse_error.
Returns The input stream.
try
{
    auto tbl = toml::parse("enabled = trUe"sv);
}
catch (const toml::parse_error & err)
{
    std::cerr << "Parsing failed:\n"sv << err << "\n";
}
Parsing failed:
Encountered unexpected character while parsing boolean; expected 'true', saw 'trU'
    (error occurred at line 1, column 13)