Skip to content

Commit 52b2225

Browse files
committed
fable: Fix compatibility issues with nlohmann_json 3.11
1 parent 5d646b1 commit 52b2225

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

fable/include/fable/conf.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,9 @@ class Conf {
190190
try {
191191
return data_.at(key).get<T>();
192192
} catch (nlohmann::detail::out_of_range&) {
193-
throw_missing(key);
193+
throw_missing(key.to_string());
194194
} catch (nlohmann::detail::type_error&) {
195-
throw_wrong_type(key);
195+
throw_wrong_type(key.to_string());
196196
}
197197
}
198198

@@ -224,7 +224,7 @@ class Conf {
224224
} catch (nlohmann::detail::out_of_range&) {
225225
return def;
226226
} catch (nlohmann::detail::type_error&) {
227-
throw_wrong_type(key);
227+
throw_wrong_type(key.to_string());
228228
}
229229
}
230230

@@ -279,7 +279,7 @@ class Conf {
279279
} catch (nlohmann::detail::out_of_range& e) {
280280
return;
281281
} catch (nlohmann::detail::type_error& e) {
282-
throw_wrong_type(key);
282+
throw_wrong_type(key.to_string());
283283
}
284284
}
285285

fable/src/fable/conf.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ void Conf::assert_has(const std::string& key) const {
114114

115115
void Conf::assert_has(const JsonPointer& key) const {
116116
if (!has(key)) {
117-
throw_missing(key);
117+
throw_missing(key.to_string());
118118
}
119119
}
120120

@@ -130,7 +130,7 @@ void Conf::assert_has_not(const std::string& key, const std::string& msg) const
130130

131131
void Conf::assert_has_not(const JsonPointer& key, const std::string& msg) const {
132132
if (has(key)) {
133-
throw_unexpected(key, msg);
133+
throw_unexpected(key.to_string(), msg);
134134
}
135135
}
136136

@@ -144,7 +144,7 @@ void Conf::assert_has_type(const std::string& key, JsonType t) const {
144144
void Conf::assert_has_type(const JsonPointer& key, JsonType t) const {
145145
assert_has(key);
146146
if (data_.at(key).type() != t) {
147-
throw_wrong_type(key, t);
147+
throw_wrong_type(key.to_string(), t);
148148
}
149149
}
150150

fable/src/fable/environment_test.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include <gtest/gtest.h> // for TEST, ASSERT_EQ, ...
2727
#include <boost/optional.hpp> // for optional<>
28+
#include <boost/optional/optional_io.hpp>
2829

2930
#include <fable/environment.hpp> // for Environment
3031

0 commit comments

Comments
 (0)