File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -29,9 +29,21 @@ auto read(InputVarType _var) {
2929// / Reads a TOML string.
3030template <class T , class ... Ps>
3131Result<internal::wrap_in_rfl_array_t <T>> read (
32- const std::string_view _toml_str) {
33- auto table = ::toml::parse (_toml_str);
34- return read<T, Ps...>(&table);
32+ const std::string_view _toml_str) noexcept {
33+ #if TOML_EXCEPTIONS
34+ try {
35+ auto table = ::toml::parse (_toml_str);
36+ return read<T, Ps...>(&table);
37+ } catch (const std::exception& e) {
38+ return error (e.what ());
39+ }
40+ #else
41+ auto result = ::toml::parse (_toml_str);
42+ if (!result) {
43+ return error (std::string (result.error ().description ()));
44+ }
45+ return read<T, Ps...>(&result.table ());
46+ #endif
3547}
3648
3749// / Parses an object from a stringstream.
You can’t perform that action at this time.
0 commit comments