mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-17 17:58:09 +08:00
feat: enable to get error_kind from error_info
and add serialization_error for future update
This commit is contained in:
@@ -13,7 +13,8 @@ enum class error_kind : std::uint8_t
|
||||
out_of_range,
|
||||
type_error,
|
||||
syntax_error,
|
||||
file_io_error
|
||||
file_io_error,
|
||||
serialization_error
|
||||
};
|
||||
|
||||
// error info returned from parser.
|
||||
@@ -44,6 +45,9 @@ struct error_info
|
||||
locations_(std::move(l)), suffix_(std::move(s))
|
||||
{}
|
||||
|
||||
error_kind& kind() noexcept {return kind_;}
|
||||
error_kind kind() const noexcept {return kind_;}
|
||||
|
||||
std::string const& title() const noexcept {return title_;}
|
||||
std::string & title() noexcept {return title_;}
|
||||
|
||||
@@ -100,7 +104,7 @@ template<typename ... Ts>
|
||||
error_info make_error_info(
|
||||
std::string title, source_location loc, std::string msg, Ts&& ... tail)
|
||||
{
|
||||
error_info ei(std::move(title), std::move(loc), std::move(msg));
|
||||
error_info ei(error_kind::runtime_error, std::move(title), std::move(loc), std::move(msg));
|
||||
return detail::make_error_info_rec(ei, std::forward<Ts>(tail) ... );
|
||||
}
|
||||
template<typename ... Ts>
|
||||
|
Reference in New Issue
Block a user