15#if TOML_DOXYGEN || !TOML_EXCEPTIONS
16#define TOML_PARSE_ERROR_BASE
18#define TOML_PARSE_ERROR_BASE : public std::runtime_error
31 std::string description_;
41 : std::runtime_error{desc}, source_{std::move(src)} {}
45 parse_error(
const char* desc,
const source_region& src)
noexcept
58 : description_{std::move(desc)}, source_{std::move(src)} {}
76 return std::string_view{what()};
111 impl::print_to_stream(
lhs,
rhs.description());
112 impl::print_to_stream(
lhs,
"\n\t(error occurred at "sv);
113 impl::print_to_stream(
lhs,
rhs.source());
114 impl::print_to_stream(
lhs,
")"sv);
123#undef TOML_PARSE_ERROR_BASE
An error generated when parsing fails.
TOML_NODISCARD_CTOR parse_error(std::string &&desc, source_region &&src) noexcept
TOML_NODISCARD_CTOR parse_error(std::string &&desc, const source_region &src) noexcept
friend std::ostream & operator<<(std::ostream &lhs, const parse_error &rhs)
Prints a parse_error to a stream.
TOML_NODISCARD const source_region & source() const noexcept
Returns the region of the source document responsible for the error.
TOML_NODISCARD_CTOR parse_error(std::string &&desc, const source_position &position, const source_path_ptr &path={}) noexcept
TOML_NODISCARD std::string_view description() const noexcept
Returns a textual description of the error.
#define TOML_EXCEPTIONS
Sets whether the library uses exceptions to report parsing failures. \detail Defaults to 1 or 0 accor...
#define TOML_NODISCARD_CTOR
#define TOML_ABI_NAMESPACE_BOOL(cond, T, F)
std::shared_ptr< const std::string > source_path_ptr
A pointer to a shared string resource containing a source path.
A source document line-and-column pair.
A source document region.