Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions include/rfl/toml/read.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,21 @@ auto read(InputVarType _var) {
/// Reads a TOML string.
template <class T, class... Ps>
Result<internal::wrap_in_rfl_array_t<T>> read(
const std::string_view _toml_str) {
auto table = ::toml::parse(_toml_str);
return read<T, Ps...>(&table);
const std::string_view _toml_str) noexcept {
#if TOML_EXCEPTIONS
try {
auto table = ::toml::parse(_toml_str);
return read<T, Ps...>(&table);
} catch (const std::exception& e) {
return error(e.what());
}
#else
auto result = ::toml::parse(_toml_str);
if (!result) {
return error(std::string(result.error().description()));
}
return read<T, Ps...>(&result.table());
Comment thread
liuzicheng1987 marked this conversation as resolved.
#endif
}

/// Parses an object from a stringstream.
Expand Down
Loading