From 746abd73db83c6dd0632e8bdd617bc93be4d2f7e Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Thu, 4 Jul 2024 02:55:47 +0900 Subject: [PATCH] feat: enable to get error_kind from error_info and add serialization_error for future update --- include/toml11/fwd/error_info_fwd.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/toml11/fwd/error_info_fwd.hpp b/include/toml11/fwd/error_info_fwd.hpp index 1382dd6..da3ddf2 100644 --- a/include/toml11/fwd/error_info_fwd.hpp +++ b/include/toml11/fwd/error_info_fwd.hpp @@ -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 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(tail) ... ); } template